note 101301 deleted from function.session-start by peehaa

From: Date: Fri, 09 Dec 2016 22:25:24 +0000
Subject: note 101301 deleted from function.session-start by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208359@lists.php.net to get a copy of this message
Note Submitter: chong at completemr dot com ---- 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.

« previous php.notes (#208359) next »