rubing Posted March 5, 2008 Share Posted March 5, 2008 I have been wrestling with this all night and can't find an answer. Everybody says there has to be no blank lines or white space in your script when using the session_start() command, so I eliminated all of the blanks and put it on the very first line as follows: <?php session_start(); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> ...[b] rest of webpage a seperate php script starts again later.[/b] yet when I go to the page I still get this error: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/rubing/public_html/days/friday/fri3.php:1) in /home/rubing/public_html/days/friday/fri3.php on line 1 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/rubing/public_html/days/friday/fri3.php:1) in /home/rubing/public_html/days/friday/fri3.php on line 1 Quote Link to comment Share on other sites More sharing options...
revraz Posted March 5, 2008 Share Posted March 5, 2008 Look at the code in notepad and make sure there are not any white spaces or hidden characters on the first line before the session_start() Quote Link to comment Share on other sites More sharing options...
AV1611 Posted March 5, 2008 Share Posted March 5, 2008 1. is the above code from script fri3.php? If it's called from another script, it won't work ... depending... Are you in Windows? Some text editors have characters that are not human readable. Try using notepad and resaving. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 5, 2008 Share Posted March 5, 2008 From the error message (output started at ... fri3.php:1) either there is some white-space before the first opening <?php tag OR your file is saved in UTF-8 format and the BOM (Byte Order Mark) characters at the start of the file are being output to the bowser as content. Make sure your file is save in ANSI/ASCII mode. Quote Link to comment Share on other sites More sharing options...
rubing Posted March 5, 2008 Author Share Posted March 5, 2008 I just used code editor in cpanel and found the following odd characters at the very start of my file: <?php session_start(); Are these UTF-8 BOM? I am using Notepad++ in windowsxp on my home machine and don't see them there. Quote Link to comment Share on other sites More sharing options...
revraz Posted March 5, 2008 Share Posted March 5, 2008 Yes. Save them with your text editor instead. I just used code editor in cpanel and found the following odd characters at the very start of my file: <?php session_start(); Are these UTF-8 BOM? I am using Notepad++ in windowsxp on my home machine and don't see them there. Quote Link to comment Share on other sites More sharing options...
rubing Posted March 5, 2008 Author Share Posted March 5, 2008 WOW! I'm really glad you guys were here to help me on that one. I would've given up and been completely disgruntled otherwise. I can't believe this wasn't pointed out in any of the books i am reading, especially since everybody's always pimping utf-8. Quote Link to comment 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.