Php Script Authentication Error

liunx

Guest
I get the following error when trying to do some simple HTTP authentication in a PHP script. I've never seen this before, and I can't find anything about it in the PHP manual. Any help would be appreciated. Thanks.<br /><br />Warning: Cannot modify header information - headers already sent by (output started at /home/vphmubkc/public_html/timesheet/index.php:18) in /home/vphmubkc/public_html/timesheet/index.php on line 30<!--content-->
Nevermind, Davids answer was better sounding than mine.<!--content-->
Welcome to the forums, vphmubkc! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/thumbup1.gif" style="vertical-align:middle" emoid=":thumbup1:" border="0" alt="thumbup1.gif" /> <br /><br />At line 18 in your script, there is some statement that is sending actual content to the browser (echo, print, content or HTML outside of <?php ... ?> tags, etc.). This triggers all HTTP headers to be automatically sent, as the HTTP headers must all be sent before any content or HTML is sent to the browser.<br /><br />At line 30 of your script, there is a function that is trying to add or modify the HTTP headers (probably <!--fonto:Courier--><span style="font-family:Courier"><!--/fonto-->header()<!--fontc--></span><!--/fontc--> ). Since all HTTP headers were already sent to the browser at line 18 of your script (along with whatever content or HTML was output), the HTTP headers can no longer be added to or modified, and this triggers the PHP error message you're seeing.<br /><br />Hope this helps...<!--content-->
Welcome to the forums vphmubkc <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> <br /><br />I have done the same thing by just having a space at the head of a script bfore going into php.<!--content-->
Welcome to the forum, vphmubkc. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
<!--QuoteBegin-TCH-Rob+Jul 8 2005, 07:27 PM--><div class='quotetop'>QUOTE(TCH-Rob @ Jul 8 2005, 07:27 PM)</div><div class='quotemain'><!--QuoteEBegin-->Nevermind, Davids answer was better sounding than mine.<br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=139126"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />Sorry! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> <br /><br /><!--QuoteBegin-vphmubkc+Jul 8 2005, 06:38 PM--><div class='quotetop'>QUOTE(vphmubkc @ Jul 8 2005, 06:38 PM)</div><div class='quotemain'><!--QuoteEBegin-->I get the following error when trying to do some simple HTTP authentication in a PHP script.  I've never seen this before, and I can't find anything about it in the PHP manual.<br /><div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=139120"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />I found this <a href="http://us3.php.net/manual/en/faq.using.php#faq.using.headers-sent" target="_blank">FAQ</a> in the PHP manual that is probably most applicable to your issue:<br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec--><b>6.  I get the message 'Warning: Cannot send session cookie - headers already sent...' or 'Cannot add header information - headers already sent...'.</b><br /><br />The functions header(), setcookie(), and the session functions need to add headers to the output stream but headers can only be sent before all other content. There can be no output before using these functions, output such as HTML. The function headers_sent() will check if your script has already sent headers and see also the Output Control functions.<!--QuoteEnd--></div><!--QuoteEEnd--><br />Even though your error is 'Cannot <b>modify</b> header information' rather than 'Cannot <b>add</b> header information', this FAQ answer is still applicable.<br /><br /><!--QuoteBegin-TCH-Don+Jul 8 2005, 11:36 PM--><div class='quotetop'>QUOTE(TCH-Don @ Jul 8 2005, 11:36 PM)</div><div class='quotemain'><!--QuoteEBegin-->I have done the same thing by just having a space at the head of a script bfore going into php.<div align="right"><a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=139147"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><!--QuoteEnd--></div><!--QuoteEEnd--><br />It could be simply a blank line or space, but whatever it is, it's at line 18, rather than at the beginning or end of the script. A couple of examples of what could cause this error:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->17: ?><br />18:<br />19: <?php<!--c2--></div><!--ec2--><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->18: ?> <?php<!--c2--></div><!--ec2--><!--content-->
Welcome to the forums, vphmubkc<!--content-->
 
Back
Top