FAST CGI + header not sended RRS feed

  • Question

  • User-70257434 posted


    I just went from CGI to FASTCGI with the new fastCGI handler and get some errors with some header :

    I use this header "X-JSON" for web 2.0 issues with prototype,

    example :

    header('X-JSON : A_JSON_STRING ' );

    And this header disappears with PHP in fastCGI mode ?

    There is another problem with all my

    header("Location : A_WELL_FORMATTED_URL")

    Which are located in code, but no text is displayed before it. And with normal CGI it is fonctional and with ISAPI too.

    Should I have to add something in FasCGI configuration or is there a BUG with fast cgi and Headers ?

    I think that thereis a big problem with php headers with FastCGI module !?

    Thanks in advance because whis this problem, I have to rewrite so much code !


    Monday, June 23, 2008 5:34 AM

All replies

  • User2072887442 posted

    This works well for me:

    header('X-JSON: test');
    echo '1';


    c:\>wget.exe "http://localhost/1.php" --spider -S
    http://localhost/1.php => `1.php'
    Resolving localhost...
    Connecting to localhost||:80... connected.
    HTTP request sent, awaiting response...
      HTTP/1.1 200 OK
      Server: Microsoft-IIS/5.1
      X-Powered-By: ASP.NET
      Connection: keep-alive
      X-JSON: test
      Content-type: text/html
      Content-Length: 0
    Length: 0 [text/html]
    200 OK

    PHP/FastCGI is installed using this instruction: Install PHP with FastCGI


    Monday, June 23, 2008 12:46 PM
  • User-70257434 posted

    That is not the question because,

    it works well for with CGI and ISAPI..... but NOT with FastCGI.... I think so there is a problem with FASTCGI not my code, I can't put all my header in first line of code... Just think your header is or isn't X-JSON or Location and this arrive at line 100 of your code !

    'cause I want to go with FastCGI, so I don't want to rewrite 1000 lines of code !

    Thanks in advance



    Thursday, June 26, 2008 9:17 AM
  • User2072887442 posted

    I test all my projects with IIS FastCGI and never have any issue related to headers.

    So, at least the simple example that I've posted works on your computer?

    Thursday, June 26, 2008 9:42 AM
  • User-70257434 posted


    Sorry for my last answer, I was just spending hours trying to any answer on this problem. And I didn't found any.

    So, I tested your example, first, I got an UNHAUTHORIZED, normal , I use "Integrated Windows authentification".and  wget don't send it. Anyway I went to IIS remove this authentification for tests. And miracle, I test just one URL who has a X-JSON. And got answer with X-JSON.

    Finally, I think that there is a problem with  "Integrated Windows authentification" - FAST-CGI and PHP header ! Together.

    Hope someone can find any answer quickly.

    Thanks in advance.


    Friday, June 27, 2008 2:53 AM
  • User2072887442 posted

    I've set "Integrated Windows Authentication" and open http://localhost/1/1.php in FireFox (it is configured to send NTLM credentials to localhost) and check the headers with FireBug: "X-JSON: test" header is on the place. So my sample works well with NTML authentication.



    Friday, June 27, 2008 4:45 AM
  • User-70257434 posted


    Thanks for quick support. !

    I just found the answer :

    If you add a stupid "space" beetween "X_JSON" and ":" header would NOT be recognized by FastCGI but recognized by CGI, FASTCGI and APACHE ! (the same with "header("location: http:/...") is not good too.

    It is odd that I could not find any information about this problem anywhere !?  

    Don't ask me why... But it took me so much time to find it.

    Thanks Again 

    Friday, June 27, 2008 9:39 AM