beemer832 Posted February 1, 2011 Share Posted February 1, 2011 First want to start by saying these pages work perfect on my own hosted devel server running centos5. I am moving these to godaddy for production and am running into this error: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/93/6413093/html/classifieds/login.php:7) in /home/content/93/6413093/html/classifieds/init.php on line 2 The first page you browse to is index.php: <? header('location: secured_page.php'); ?> Header refers it to secured_page.php: <? require('init.php'); ?> Then there is a bunch of HTML code under neath this page. This is the secured (password protected) page. The init.php that is required: <? session_start(); require('config.php'); require('quotes.php'); With more PHP code under neath. The first 7 lines of the login.php page are all HTML code. The 7th line in this page that is PHP is: : sha1(sha1($_REQUEST['password']).$_SESSION['salt']); I cannot for the life of me figure out why this is happening. Checked for whitespace and characters before the session_start() in the init.php file. Any and all help is greatly appreciated. thanks -beemer Link to comment https://forums.phpfreaks.com/topic/226313-session_start-help-needed-please/ Share on other sites More sharing options...
wigpip Posted February 1, 2011 Share Posted February 1, 2011 gday you need to put : ob_start(); function at very top of page Link to comment https://forums.phpfreaks.com/topic/226313-session_start-help-needed-please/#findComment-1168206 Share on other sites More sharing options...
Pikachu2000 Posted February 1, 2011 Share Posted February 1, 2011 You cannot output anything at all to the browser before sending headers. session_start() sends headers. Link to comment https://forums.phpfreaks.com/topic/226313-session_start-help-needed-please/#findComment-1168207 Share on other sites More sharing options...
beemer832 Posted February 1, 2011 Author Share Posted February 1, 2011 which page do you add the: ob_start(); ?? thanks -beemer Link to comment https://forums.phpfreaks.com/topic/226313-session_start-help-needed-please/#findComment-1168209 Share on other sites More sharing options...
Pikachu2000 Posted February 1, 2011 Share Posted February 1, 2011 Output buffering is a hack. You'd be better off simply making sure session_start() is called before anything is output to the browser. It should be easy enough to do. Link to comment https://forums.phpfreaks.com/topic/226313-session_start-help-needed-please/#findComment-1168210 Share on other sites More sharing options...
trq Posted February 1, 2011 Share Posted February 1, 2011 First want to start by saying these pages work perfect on my own hosted devel server running centos5. I am moving these to godaddy for production and am running into this error: You should always develop on a server with php configured to display errors and have error reporting on and configured to show ALL types of errors. which page do you add the: ob_start(); ?? thanks -beemer You don't. Fix your code. The error says that output is starting on line 7, figure out where that is and remove whatever is causing output. Link to comment https://forums.phpfreaks.com/topic/226313-session_start-help-needed-please/#findComment-1168212 Share on other sites More sharing options...
beemer832 Posted February 1, 2011 Author Share Posted February 1, 2011 Error handling was on with the devel server, just making the point that Godaddy does not have a very good default php.ini file. I am using the same error handling on both servers now. Not trying to have someone else fix my code, just trying to understand why it works on one server, but not the other. I am under the assumption that the header() redirect on the index.php is sending output to the browser. Will investigate further. thanks -beemer Link to comment https://forums.phpfreaks.com/topic/226313-session_start-help-needed-please/#findComment-1168213 Share on other sites More sharing options...
Pikachu2000 Posted February 1, 2011 Share Posted February 1, 2011 If the same output was there, the code didn't work on the devel server either. Link to comment https://forums.phpfreaks.com/topic/226313-session_start-help-needed-please/#findComment-1168215 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.