note 101301 added to function.session-start

From: Date: Thu, 09 Dec 2010 03:11:02 +0000
Subject: note 101301 added to function.session-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-174723@lists.php.net to get a copy of this message
We are facing a problem and getting an error when loading a php page Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent by (output started at /www/http/example/zh_CN/unsubscribe.php:1) in /www/http/example/inc/common.php on line 4 We had google and browse through some helps file and found some suggestion as below. 1. Use ob_start to cache any output before session_start function. 2. Make sure the session.save_path in php.ini is set and point to a valid path We had tried the above but still having some the same problem. We are using notepad ++ for the coding. And we notice that this file is somehow being encoded to UTF-8 by one of my colleague because he though that this will help to display the result in the correct languages. Solution: Change the encode to use ANSI and make sure the EOL conversion is set to UNIX. Bingo. Things are back to normal as expected. Note: The encode might cause this problem in certain machine but not others. So i had no clue on this. We had no problem running the php code with UTF-8 encode in a 64bits Linux Enterprise but hit the problem running in a 32 bits Linux slackware. Hope this helps. ---- Server IP: 69.147.83.197 Probable Submitter: 175.136.249.33 ---- Manual Page -- http://www.php.net/manual/en/function.session-start.php Edit -- https://master.php.net/note/edit/101301 Del: integrated -- https://master.php.net/note/delete/101301/integrated Del: useless -- https://master.php.net/note/delete/101301/useless Del: bad code -- https://master.php.net/note/delete/101301/bad+code Del: spam -- https://master.php.net/note/delete/101301/spam Del: non-english -- https://master.php.net/note/delete/101301/non-english Del: in docs -- https://master.php.net/note/delete/101301/in+docs Del: other reasons-- https://master.php.net/note/delete/101301 Reject -- https://master.php.net/note/reject/101301 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#174723) next »