#25834 [Opn->Fbk]: Intermittent CGI Errors - PHP in CGI mode win2003
| From: | sniper@php.net | Date: | Mon, 13 Oct 2003 08:40:37 +0000 |
| Subject: | #25834 [Opn->Fbk]: Intermittent CGI Errors - PHP in CGI mode win2003 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-48906@lists.php.net to get a copy of this message | ||
ID: 25834
Updated by: sniper@php.net
Reported By: sales at 4web-space dot com
-Status: Open
+Status: Feedback
Bug Type: CGI related
Operating System: windows 2003 standard
PHP Version: 4.3.3
New Comment:
Leave status at 'Feedback' until you do.
Previous Comments:
------------------------------------------------------------------------
[2003-10-13 04:20:54] sales at 4web-space dot com
Will try it and report back
------------------------------------------------------------------------
[2003-10-12 22:07:53] 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
------------------------------------------------------------------------
[2003-10-11 08:03:30] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25834&edit=1