View Full Version : Cannot Send Session Cookie Error

06-22-2005, 11:58 AM

My project works well offline, today i upload to a server, but on some pages it gives the following error

session_start(): Cannot send session cookie - headers already sent by (output started at D:\vhosts\abc.com\httpdocs\ant\header1.php:9) in D:\vhosts\abc.com\httpdocs\ant\viewcart.php on line 6

Kindly tell me that how can i solve this issue.


06-22-2005, 12:05 PM
That means that on some pages you are sending data to the browser before you try to se the cookie. This isn't allowed, if you send ANY data to the browser, even if you just have one single linebreak or whitespace before your <?php tag then you cannot send headers and this error will be generated.

If the project is working offline but not online, it could be that your host is inserting something which is causing the headers to be sent before your code is executed, or it could be that the error level is set differently in your home and server environments and the error is just being hidden when you try to view the page offline. It's impossible to pinpoint the cause though without seeing some code.