« Previous Next »

Thread: Problem with PHP and file encoding

Last post 07-03-2009 12:23 AM by jonlau. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 04-21-2009, 6:14 AM

    • Sevein
    • Not Ranked
    • Joined on 09-19-2006, 11:28 PM
    • Posts 1

    Problem with PHP and file encoding

    Hi! When I call session_start() PHP function, PHP engine (through FastCGI) gives me the next warning:

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\foo\bar.utf8.php:1) in C:\foo\bar.utf8.php on line 1

    The only way I found to avoid this problem is setting my scripts file encoding to ANSI. Actually, I discover that:

    1. If my script file encoding is ANSI, everything is okay.
    2. If my script file encoding is UTF-8, I receive the warning described before happens.
    3. If my script file encoding is Unicode (UTF-16, UCS-2) the web server doesn't give a response, so my browser gets waiting for it.

    Talking about my case, UTF-8, the problem seems to be that some output is beeing sent before the header sent by my script. Actually, I can reproduce the same problem with this simple script file:

     <?php header("Location: http://forums.iss.net"); ?>

    So, as I expected, the warning received is:

    Warning: Cannot modify header information - headers already sent by (output started at C:\foo\bar.utf8.php:1) in C:\foo\bar.utf8.php on line 1

    Of course, this problem is solved when I enable ouput_buffering in PHP, allowing my scripts to modify headers whenever. Do you think this is a bug or something wrong in my IIS7/FastCGI/php.ini configuration?

    Thanks in advance,

    Jesús García Crespo

  • 07-03-2009, 12:23 AM In reply to

    • jonlau
    • Not Ranked
    • Joined on 07-03-2009, 12:20 AM
    • Posts 1

    Re: Problem with PHP and file encoding

    i've similar problem where the PHP UTF-8 encoding works on window server 2000.

    Just moved to IIS7+fastcgi on windows server 2008 and the php is showing ??? ( non-english chars)...it needs to support chinese, english & japanese languages.

    Any solutions or setting in php.ini?

    Regards,

    Jon Lau 

     

Page 1 of 1 (2 items)
Microsoft Communities