If you use Windows Notepad to edit PHP file and save it as Unicode,
then you may have probability to encounter PHP errors –
“Cannot send session cookie – headers already sent by …”

If you use Notepad to edit PHP and save as Unicode

notepad_php_unicode_01

Then, if you use some Hex editor (e.g. HHD Hex editor) to open it

notepad_php_unicode_02

You will find the first 3 bytes are non PHP code, those 3 bytes probably for Unicode recognition.

You may use Hex editor to delete the 3 bytes, then upload to the server, and test again.

notepad_php_unicode_03

The Apache web server should not generate the above message anymore.

As we know, some other text editor in Windows also generate the first 3 bytes character. However, if you use Dreamweaver (version 8 or above) and save in utf8, it works fine.

Thank you.

Pin It on Pinterest

Share This