|
Subject:
|
"headers already sent" - one cure
|
|
Posted By:
|
tks001
|
Post Date:
|
2/20/2006 3:07:05 PM
|
Hi again guys.
Re: Passing variables with cookies pp. 49-52
If you are using Notepad as your text editor and you save your file as 'somename.php' with UTF-8 encoding, you will always get "headers already sent". Apparently:
If you save your php script as UTF-8, HTML output will start at line 1 (script tag start) and setcookie() will fail.
If you save the page as ANSI setcookie() will work properly.
As an aside, I was able to set session.auto_start=0 in the php.ini file and the manual session_start() command worked for this page.
If anyone gets a "Headers already sent" error, check the encoding of your script page.
UTF-8 encoded scripts start output at the php tag declaration.
This was probably covered early in Ch. 1 and I just missed it, but for those of you who also missed it, here it is again!
|
|
Reply By:
|
tks001
|
Reply Date:
|
2/20/2006 6:05:54 PM
|
I have changed text editors to a charityware text editor called "Vim" as a result of the encoding (and lack of line numbers, sytax tools, color highlighting, etc.) issue and realizing that using Notepad is a "stone age", ineffective way to go if I am going to be a programmer.
|