Working on the first "Passing the Visitor's Username". Using Windows XP, PHP 5.1.2, Apache 2.1, kept getting "headers already sent" warning when viewing movie1.php.
What worked for me:
1. Created the c:\tmp directory (I don't know if this is still necessary)
2. Located php.ini file in c:\windows
3. Changed "session.auto_start = 0" to " = 1"
4. Saved the php.ini file
5. Deleted session cookie in my browser, closed browser
6. Restarted Apache (to get the changed php.ini info)
7. Voila! success ... hope this saves someone 24 hair pulling hours
Here is the background for those of you who are readers.
Kept getting the "headers already sent" Warning. I found this valuable insight at
http://phpbuilder.com/manual/en/ref....sion.save-path
Note: Prior to PHP 4.3.6, Windows users had to change this variable in order to use PHP's session functions. A valid path must be specified, e.g.: c:/temp.
In other words, you don't have to specify a path for session.save_path in your php.ini file as advised in paragraph 5, p. 47.
What you DO have to do though, is to is to set session.auto_start
; Initialize session on request startup.
session.auto_start = 1
The default setting is session.auto_start = 0.
I found another post saying changing session.cookie_path -
; The path for which the cookie is valid.
session.cookie_path = /
to "session.cookie_path = \" worked for them.
It works with the default setting. Don't waste your time on that one for the first example.
Now on to passing the username with a cookie. Settings in php.ini may have to be changed again :)