Community Auth For CodeIgniter 3 |
seems like header has already been send... some visible code has been send from server, and header() cannot work after.
NexoPOS 2.6.2 available on CodeCanyon.
(12-27-2015, 11:55 AM)skunkbad Wrote:(12-27-2015, 06:31 AM)Blair2004 Wrote: seems like header has already been send... some visible code has been send from server, and header() cannot work after. My first post, resurrecting an old post ... I've run into what looks like the same warning message and have some info to add. My app is producing this: Quote:A PHP Error was encountered On the Examples/recover page. I've read the comments that the warning appears due to some visible code being sent or a cookie being set after the headers have been sent. I think a cookie being set is exactly the problem, but only under a certain circumstance. I've also read the comment about a possible change to the Example code, but in my case the only change is to the user details in create_user. I noticed that if I commented out: echo $this->load->view('examples/page_header', '', TRUE); in the Examples controller, the page would load without error, albeit without the header. Looking further, this line: echo $this->load->view('examples/recover_form', ( isset( $view_data ) ) ? $view_data : '', TRUE ); that loads the recover view, at some point in the chain of code downwards has a call to 'setcookie'. Setting a cookie after the page_header view has already been output to screen, triggers the PHP warning, and commenting page_header out prevented it, as would be expected. Commenting out setcookie also allowed the page to load normally, even with page_header enabled again. I restored setcookie and get the warning again. However, the warning message is only shown when the PHP error reporting level is set to do so. My project is set to 'development' with this line in index.php. define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); If I change 'development' to 'production', the error reporting level is set higher and the warning message is never shown. Should I just ignore the warning, always work in production mode, make some change to the Community Auth code or perhaps something else? - Simon (01-05-2017, 01:30 AM)simon Wrote:(12-27-2015, 11:55 AM)skunkbad Wrote:(12-27-2015, 06:31 AM)Blair2004 Wrote: seems like header has already been send... some visible code has been send from server, and header() cannot work after. Have you done anything code-wise, or is this a straight out of the box install? If I do a basic install and switch the environment to production, there is no difference, and I don't get any errors. (01-05-2017, 05:08 PM)skunkbad Wrote:(01-05-2017, 01:30 AM)simon Wrote:(12-27-2015, 11:55 AM)skunkbad Wrote:(12-27-2015, 06:31 AM)Blair2004 Wrote: seems like header has already been send... some visible code has been send from server, and header() cannot work after. I installed the base CI system about 6 months ago and have come back and to on it since then. However, as far as I know, my changes are: 1. Changed the system to not include index.php in the URL. 2. Add a connection to a MySQL database. 3. Add a controller, model and views for a follow-along tutorial that lists/adds news items. 4. Added an 'Assets' folder that includes jQuery, Bootstrap, Fontawesome and Datatables.net, but have not yet used them. 5. Updated to CI 3.1.2. 6. Added Community Auth. 7. Some editing of the Community Auth files, during debugging after seeing the warning message. #7 is significant as I think the original error was on line 243. I did find a couple of other sites like https://portal.verranti.co.uk/user/recover while Googling, that might be the same or similar situation.
You'd usually only get that error if you are trying to set a cookie or do something with the session after you've already echoed something, or otherwise sent something to the browser. If you're using an unmodified Community Auth examples controller, I don't have any idea why you're having the problem you are having, but it would require that you do some debugging. I'd say that you should for sure take a close look at the Community Auth documentation regarding installation and make sure you did each step. That way you can be sure you're not having a problem with Community Auth. Community Auth is well tested in the wild, and if something was wrong with it, there would be a bunch of people leaving similar comments here in the forum. Beyond that, I can possibly help you figure out what's wrong, but I'd need access to your server. Another option would be to zip up your site with a database backup and make it available for me to download.
(01-05-2017, 08:29 PM)skunkbad Wrote: You'd usually only get that error if you are trying to set a cookie or do something with the session after you've already echoed something, or otherwise sent something to the browser. If you're using an unmodified Community Auth examples controller, I don't have any idea why you're having the problem you are having, but it would require that you do some debugging. I'd say that you should for sure take a close look at the Community Auth documentation regarding installation and make sure you did each step. That way you can be sure you're not having a problem with Community Auth. Community Auth is well tested in the wild, and if something was wrong with it, there would be a bunch of people leaving similar comments here in the forum. Beyond that, I can possibly help you figure out what's wrong, but I'd need access to your server. Another option would be to zip up your site with a database backup and make it available for me to download. Thanks for your help with this. I know I'm getting something wrong, but can't pin it down. I've been on it all weekend and am ready to hit the bottle. Hard. You kindly offered to have a look at what I've got, but my example is on my machine. So I hooked up with Digital Ocean and used Server Pilot to set up a server. I was able to see the exact same warning, but it seemed like too many other issues, so I deleted that. This time I set up a LAMP droplet on Digital Ocean with no help from Server Pilot. Although there were a lot of bumps along the way, the good news is that the PHP warning no longer appears on the recover page. But the downside is that login no longer works. I've used your defaults, except for setting the level to 9. The username and password are accepted without error and the log shows them as entered, with no other reference to the login, as follows: DEBUG - 2017-01-08 05:51:58 --> string = skunkbot password = PepeLePew7 form_token = da471f16 token_jar = ["e8908856","7989796b","da471f16"] DEBUG - 2017-01-08 05:51:58 --> Config file loaded: /var/www/html/application/third_party/community_auth/config/form_validation/login.php DEBUG - 2017-01-08 05:51:59 --> Total execution time: 0.3854 DEBUG - 2017-01-08 05:51:59 --> UTF-8 Support Enabled DEBUG - 2017-01-08 05:51:59 --> Global POST, GET and COOKIE data sanitized DEBUG - 2017-01-08 05:51:59 --> Config file loaded: /var/www/html/application/third_party/community_auth/config/db_tables.php DEBUG - 2017-01-08 05:51:59 --> Config file loaded: /var/www/html/application/third_party/community_auth/config/authentication.php DEBUG - 2017-01-08 05:51:59 --> Session: "sess_save_path" is empty; using "session.save_path" value from php.ini. DEBUG - 2017-01-08 05:51:59 --> Encryption: Auto-configured driver 'openssl'. DEBUG - 2017-01-08 05:51:59 --> Total execution time: 0.0064 DEBUG - 2017-01-08 05:51:59 --> UTF-8 Support Enabled DEBUG - 2017-01-08 05:51:59 --> Global POST, GET and COOKIE data sanitized DEBUG - 2017-01-08 05:51:59 --> Config file loaded: /var/www/html/application/third_party/community_auth/config/db_tables.php DEBUG - 2017-01-08 05:51:59 --> Config file loaded: /var/www/html/application/third_party/community_auth/config/authentication.php DEBUG - 2017-01-08 05:51:59 --> Session: "sess_save_path" is empty; using "session.save_path" value from php.ini. DEBUG - 2017-01-08 05:51:59 --> Encryption: Auto-configured driver 'openssl'. DEBUG - 2017-01-08 05:51:59 --> Total execution time: 0.0161 However, after logging in, we're immediately back to the login page and if Simple Verification is clicked, the page just shows 'Nobody logged in.' The URL is http://128.199.222.205/examples/simple_verification Firefox has a cookie for httpUser with the content 7460b925805d9f92742bb177f7cedf34de797090bc3eb3074e68d4b7bd09adac3337de06fbe70246ff49b75f42eabb42552b41fdfbfccad8b4cdc4399e7d5f56%2Fgcy0SO4k6j9bltEJq83Smp4gsrsjGwNjNsUQXdkpq1B4bzbanuB2rjmli8yg3TdYZtQ8wPJEta9bjudToENjQ%3D%3D Any thoughts?
I can't do much without access. I'm willing to check it out if you provide access. I'd need to be able to look at the database and files.
(01-08-2017, 12:46 AM)simon Wrote:(01-08-2017, 12:02 AM)skunkbad Wrote: I can't do much without access. I'm willing to check it out if you provide access. I'd need to be able to look at the database and files. I had to sleep, but now am awake and looking at it. I tried to message you, but your messaging is turned off. |
Welcome Guest, Not a member yet? Register Sign In |