Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
July 13, 2005, 4:15 pm
rate this thread
I am running PHP Version 4.3.11 with Apache 2.0.54 on XP Pro.
When I do a session_start(); I am getting
Warning: session_start(): Cannot send session cookie - headers already
sent in C:\apache\htdocs\sessionTest.php on line 2
echo "Date of las visit: ";
echo date("j F Y, H:i:s", $_SESSION["last_visit"]);
echo "This is your first visit";
$_SESSION["last_visit"] = time();
Any suggestion... please
Re: Warning: session_start(): Cannot send session cookie - headers already sent i
You are sending data before the session_start() call. Don't do
that. This includes blank lines, warning messages, and any text.
Move the session_start() call earlier.
^^^ If this is line 2, it's a blank line outside <?php, and it's
causing your problem. Get rid of it.
This obviously isn't the real code. The variety of ways you spell
"last" and "visit" make that obvious. Did you want braces around
the statements after the "else"? What is on line 2?
Gordon L. Burditt