Forum Moderators: coopster
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/httpd/vhosts/site.com/httpdocs/shopping_cart.php:13) in /home/httpd/vhosts/site.com/httpdocs/shopping_cart.php on line 17
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/httpd/vhosts/site.com/httpdocs/shopping_cart.php:13) in /home/httpd/vhosts/site.com/httpdocs/shopping_cart.php on line 17
sessid= seesid2=
[edited by: jatar_k at 10:37 pm (utc) on Aug. 11, 2003]
[edit reason] generalized [/edit]
At the very top of you file, make sure you don't have any spaces or HTML content before the opening <?php tag. The opening <?php tag has to be the very first thing at the very beginning of the file.
Also, I am not sure what version of PHP you are using, however I believe that older versions were quite problematic with regards to session handling. You might check to see if session.auto_start is set in php.ini, and if you don't have the ability to modify php.ini you might try adding some PHP directives to .htaccess in your public directory.
Best Regards,
Waitman
[edited by: jatar_k at 10:38 pm (utc) on Aug. 11, 2003]
[edit reason] no sigs thanks [/edit]
<?php ob_start();?> waitman - you really should remove your company name and telephone number from your post (see the TOS & charter here regarding personal information, self promotion, and signatures).
<HTML>
<HEAD>
<TITLE>test</title>
<META http-equiv=Content-Type content="text/HTML; charset=windows-1252">
</HEAD>
<body>
<?php ob_start();
session_start();
$mysessid = $PHPSESSID;
?>
<h1>test session start</h1>
</BODY>
</html>
you see, that will start the content flow out-the server.
when you try to set a header, it will barf. the headers always pop out before any content.
try echoing the top html head part for a quickie test.
echo '
<HTML>
<HEAD>
<TITLE>test</title>
<META http-equiv=Content-Type content="text/HTML; charset=windows-1252">
</HEAD>
<body>
';
make sure no whitespace no nothing before <?php!
then put your html in a template or layout or something...
take care,
you see, the way a server sets a cookie on a browser, it sends a specially crafted header line to the client. this header line tells the client to take the cookie "or else".
you can do a google search for something like "telnet HTTP/1.0" or "telnet localhost 80" or likewise to see how to check out the header content coming from the server.
if you want to watch what php spits out you can run php from the command line (without -q). Or at least you used to. For some reason on my freebsd machine with 4.3.2, it seems to not pop out the headers anymore (command line). didn't notice that before. anyone know about that one? i bet it has something to do with php-cli?
take care,