Start Session Error..Please help.
I've poked around on the internet for a solution the error message I'm getting, and I have not been successful in resolving the issue. I'm wondering if someone here can help.
The error message I get is as follows:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/nellno1/public_html/1999implant.com/zipcodetest/thank-you.php:1) in /home/nellno1/public_html/1999implant.com/zipcodetest/config.php on line 1
Here is the PHP code on the site.
From the thank-you.php (this is placed ABOVE the !DOCTYPE ... :
On the config.php file:
$first_name = $_SESSION['user']['first_name'];
$last_name = $_SESSION['user']['last_name'];
$email = $_SESSION['user']['email'];
$phone_no = $_SESSION['user']['phone_no'];
$pin_code = $_SESSION['user']['pin_code'];
$list_name = $_SESSION['user']['list_name'];
I would be very grateful for any help with this.
$local_setting = '';
$hostName = $_SERVER['HTTP_HOST'].$local_setting;
$docRoot = $_SERVER['DOCUMENT_ROOT'].$local_setting;
The "headers already sent" error message means that some output has already been generated by your script. At a glance, I'd suspect the 'config.php' file - make sure that it ends with the closing "?>" with no \n after it.
The code must also be the first thing on the page, above <html><header>... etc.
I agree with rtrethewey that config.php needs ending ?>
You might try it with the config.php merged into the main file too.
Last edited by Dasher; 08-06-2012 at 07:46 AM.
Actually, it's useful to leave the closing ?> out of included files so that you do not accidentally end up outputting anything after the closing tag. I therefore intentionally leave it out. (The parser assumes it's there when it gets to the end-of-file while in PHP mode.)
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)