ID: 25863 Comment by: marc at durdin dot net Reported By: salmanarshad2000 at yahoo dot com Status: Open Bug Type: CGI related Operating System: win32 only PHP Version: 4CVS, 5CVS, 6CVS.. New Comment:
The situation that I consistently see this bug in is: header("Location: http://site/"); The error does not occur every time. To me, this does suggest a timing issue. One piece of pertinent information is that the error is occurring on the page redirected to, and not on the page doing the redirection, as you can see from the following log entries. Steps taken to generate this were: Open web browser to default page (index.php), click on link to home.php - which detects that I am not logged in and redirects to login.php (which then fails with error 502). 2004-10-15 23:37:39 192.168.20.9 GET /index.php - 80 - 192.168.20.11 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1;+.NET+CLR+1.1.4322) 200 0 0 2004-10-15 23:37:41 192.168.20.9 GET /home.php - 80 - 192.168.20.11 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1;+.NET+CLR+1.1.4322) 302 0 0 2004-10-15 23:37:41 192.168.20.9 GET /login.php - 80 - 192.168.20.11 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1;+.NET+CLR+1.1.4322) 502 2 0 It's a real pain - IIS doesn't give any detail in its logs about the error, there are no eventlog entries, etc., and running it through Zend Server Debugger shows no issues in the headers that I can see. This is basically the code I am using to redirect: header("Location: http://" . $_SERVER['HTTP_HOST'] . str_replace("\\", "/", dirname($_SERVER['PHP_SELF'])) . $page); exit; Previous Comments: ------------------------------------------------------------------------ [2004-10-14 08:25:39] winterpalace at netspace dot net dot au Damn. Comment above isn't solution. 1 app appears to be okay , but another is still having problems. The \ is not the cause. ------------------------------------------------------------------------ [2004-10-14 07:49:07] winterpalace at netspace dot net dot au We have experienced similar probs here, except with Windows 2000 Server, CGI, and using MS SQL Server 2000. I have a theory: The DB function calls are a red herring. It's the redirection that's the problem. IIS is telling the truth. The location isn't valid. Basis: Switched to FireFox, started getting messages about the location not being found (where usually I'd get the CGI error). Looked at the code I use for redirection: header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "nextpage.php"); Found that dirname function was returning a "\" not a "/". Rewrote this as: header("Location: http://" . $_SERVER['HTTP_HOST'] . str_replace("\\","/",dirname($_SERVER['PHP_SELF'])) . "nextpage.php"); No. More. Probs. (as yet :-)) Needs testing on other setups, go ahead :-). ------------------------------------------------------------------------ [2004-10-05 00:13:52] true_weakness at hotmail dot com Hi All i have a windows 2003 sErver running IIS 6, I had the same problem with the cgi timeout, resolved by Downloading the IIS 6 resource kit. http://download.microsoft.com/download/7/8/2/782c25d3-0f90- 4619-ba36-f0d8f351d398/iis60rkt.exe With the IIS Metabase Explorer, go to the Server name, Expand LM, Go to W3SVC. Find event CGI Timeout and change the default from 300 secs to whatever you need and it works ------------------------------------------------------------------------ [2004-09-30 22:52:02] mlisondra at lisondra dot biz This has occured in my applications that use PHP 4.3.6 with a MS SQL server backend. Using Windows 2000 Server. ------------------------------------------------------------------------ [2004-09-27 18:49:19] jvanhoy at archermalmo dot com Another clue about this weird bug is.... If you make undefined or bad system calls on a Windows box the app will throw this error. For example, in moving a PHP app from a *nix environment to a Windows2003 Server env. the following line of code WILL cause the "CGI Heart attack" to occur: system("rm /usr/local/apache/sessions/$THIS_SESSID"); That dog won't hunt on an NT machine and causes this error to occur. Remove the line (or rewrite it to use the proper NT syntax) and the error goes away. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/25863 -- Edit this bug report at http://bugs.php.net/?id=25863&edit=1