jscix Posted October 25, 2007 Share Posted October 25, 2007 Ok, I'm using PHP5.1xxxx, on Apache.. I don't know what could be causing this but, On one certain script, everytime I call Session_Start(); I get the 'headers already sent out', error... However, There is most Definitely nothing being outputted to the page beforehand. I can't figure this out, everything is working fine elsewhere.. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/j/s/c/jscix/html/echains/register/index.php:1) in /home/content/j/s/c/jscix/html/echains/register/index.php on line 2 You can see it here: http://www.bawk.org/echains/register/index.php This the the script, nothing comes before this. <?php session_start(); include "../includes/DBClass.php"; $Submited = ($_POST['submit']); $errors = Array(); etcetc .. so on and so fourth.. .... *Scratches head* Quote Link to comment https://forums.phpfreaks.com/topic/74679-solved-very-odd-session_start-problem-im-stumped/ Share on other sites More sharing options...
toplay Posted October 25, 2007 Share Posted October 25, 2007 Hi, I guarantee you that you do have something output before the session_start(), otherwise you would not get that warning. Any hidden characters, spaces, HTML, etc. before "<?php" could cause this warning. Also, if there's any output (echo/print) inside the PHP tags before the session_start() would do it too. I know you say that's the script and nothing else, but please double check. Make sure each include file you're using doesn't have any spaces before "<?php" or after ending tag "?>". If you can't find the problem, the way to get around this is to use output buffering, but you should think of that as a band-aid and not the real solution. Use ob_start() before the session_start(). PHP.net page: http://us3.php.net/manual/en/function.ob-start.php hth. Quote Link to comment https://forums.phpfreaks.com/topic/74679-solved-very-odd-session_start-problem-im-stumped/#findComment-377563 Share on other sites More sharing options...
thebadbad Posted October 25, 2007 Share Posted October 25, 2007 Read my answers to this post: http://www.phpfreaks.com/forums/index.php/topic,164423.0.html Quote Link to comment https://forums.phpfreaks.com/topic/74679-solved-very-odd-session_start-problem-im-stumped/#findComment-377666 Share on other sites More sharing options...
jscix Posted October 25, 2007 Author Share Posted October 25, 2007 "If you are saving your file in UTF-8 encoding, it could be the BOM (Byte Order Mark)." -- From your suggested thread.. Thanks alot thebadbad, I never would of figured that out. Quote Link to comment https://forums.phpfreaks.com/topic/74679-solved-very-odd-session_start-problem-im-stumped/#findComment-377775 Share on other sites More sharing options...
toplay Posted October 25, 2007 Share Posted October 25, 2007 FYI - I've never had any problems using Zend Studio and saving in UTF-8. Quote Link to comment https://forums.phpfreaks.com/topic/74679-solved-very-odd-session_start-problem-im-stumped/#findComment-377895 Share on other sites More sharing options...
thebadbad Posted October 25, 2007 Share Posted October 25, 2007 I guess Zend Studio automatic saves UTF-8 without the BOM? I've set the default document format in Notepad++ to UTF-8 without BOM. Maybe the BOM should be added to the sticky "headers already sent" thread? If it isn't already.. Quote Link to comment https://forums.phpfreaks.com/topic/74679-solved-very-odd-session_start-problem-im-stumped/#findComment-377968 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.