VinnyCP Posted June 11, 2010 Share Posted June 11, 2010 Hey, guys. I've just 'finished' some project of mine, and then I tried to post it in the enterprise's server. Then the problem started in the first page, the login page: "Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/www/anfip-2007/site_anfip/Fundacao_ANFIP/fundagenda/index.php:9) in /var/www/anfip-2007/site_anfip/Fundacao_ANFIP/fundagenda/index.php on line 10" And this other error, same page: "Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/www/anfip-2007/site_anfip/Fundacao_ANFIP/fundagenda/index.php:9) in /var/www/anfip-2007/site_anfip/Fundacao_ANFIP/fundagenda/index.php on line 10" Now, let me try to understand something. The problem is with the session_start function... (tnx, Sherlock...) 1. The session_start function failed to create a cookie because there is one already. 2. It also failed because the session limiter was already set. (this is what I understood of the problem, if it isn't right, please tell me) So... Is it possible to the session.auto_start is set to '1', and that if it is, I cannot create again a session? I don't know much of how the session works, and stuff... So I dont know if it is already started, if it is a problem to start again. Can someone help me? Quote Link to comment https://forums.phpfreaks.com/topic/204508-question-about-sessionauto_start-config-and-function-session_start/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 11, 2010 Share Posted June 11, 2010 The error is occurring at the session_start() statement, but it is caused by the output your script is sending before that point - output started at ..../index.php:9 The reason your code worked on your development system is because your development system has output_buffering turned ON, which hid this problem. In order to develop code that will work on the greatest number of systems without needing to mess with settings every time you move it to a different server configuration, turn output_buffering off. Quote Link to comment https://forums.phpfreaks.com/topic/204508-question-about-sessionauto_start-config-and-function-session_start/#findComment-1070865 Share on other sites More sharing options...
VinnyCP Posted June 16, 2010 Author Share Posted June 16, 2010 Dude... This server configuration you're talking about, the output_buffering... I read about it in php.net, and then I could understand what you are talking about. The output_buffering configuration turned ON, let the cookies be started anywhere at the PHP document, but when it's turned OFF, cookies initialization like session_start() must be the first line of the page, before any HTML tag. Is it right? Quote Link to comment https://forums.phpfreaks.com/topic/204508-question-about-sessionauto_start-config-and-function-session_start/#findComment-1073003 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.