php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25834 Intermittent CGI Errors - PHP in CGI mode win2003
Submitted: 2003-10-11 08:03 UTC Modified: 2004-01-27 16:08 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: sales at 4web-space dot com Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 4.3.3 OS: windows 2003 standard
Private report: No CVE-ID: None
 [2003-10-11 08:03 UTC] sales at 4web-space dot com
Description:
------------
Hello,
thought i submitted this before but obviously not

PHP scripts are intermittently returning CGI Error - did not return a full set of headers

This was also a problem with perl and Microsoft pointed it out to be the following problem. The following solved the same error in Perl and from what I understand headers are nothing to do what the coder adds to their php scripts but what php.exe puts in. Anyway here is what they say im hoping its what the problem is (please read IIS6's rules that are enforced) Even though these rules are enforced they only cause intermittent issues with scripts

Basically IIS6 enforces additional rules that previous IIS versions didnt

For your CGI, it needs:
print "Status: 200 OK\r\n"

There are a couple of CGI rules being enforced on IIS6:
1. Per CGI 1.1, a response must contain the "Content-Type" header,
optionally the "Location" header, and also indicate the Status code via
either the "Status" header or something like "HTTP/1.1 200 OK\r\n". This is
a big gotcha for people.
2. Headers must be terminated with \r\n per HTTP 1.1 spec.

#2 has some peculiarities in that depending on the CRT's IO Mode -- in Text
mode, "\r" will be inserted for you for every "\n", while in Binary mode, no
such thing is done. This means that since you need to be certain that
"\r\n" terminates every header for IIS -- either you run in binary mode and
send the "\r\n" yourself, or you run in text mode and only send "\n". 

Reproduce code:
---------------
any code

Expected result:
----------------
it will load all the time

Actual result:
--------------
intermittent cgi errors - not returning full set of headers

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-27 11:35 UTC] willy at vuboys dot nl
Hello,

I get reports from different users running PHP in CGI mode on a Windows platform about the same issue. The strange thing is that it does not happen all the time, but occasonally. Hitting refresh in the browser will load the page afterwards without a problem.

As far as I know it is still happening on PHP4.3.4.

Is there something in the PHP script what can be done to prevent it? or is it a bug in PHP itself?
 [2004-01-27 14:58 UTC] sales at 4web-space dot com
Yes i hadnt seen it for a long time running php4.3.4 and the other day i got it but refreshing the page made it disappear. Very strange bug!

Robbie
 [2004-01-27 16:08 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

And also, use Apache. If you can reproduce this with apache, reopen.

 [2004-01-27 17:50 UTC] willy at vuboys dot nl
I would really like to be able to reproduce, but this happens on rare occasions and a refresh almost every time makes it work. I don;t think it is a problem on Apache; only IIS as far as I know.

If I am able to reproduce I get back to you guy's.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 04:01:30 2024 UTC