| 3:25 pm on Jan 25, 2008 (gmt 0)|
What is the error you receive on screen or from your log files?
| 3:54 pm on Jan 25, 2008 (gmt 0)|
On the screen is just a CGI error because the app didn't send back the right HTTP headers. What log files should I look in?
Syslog doesn't have anything in there (unless I'm looking in the wrong place).
| 4:27 pm on Jan 25, 2008 (gmt 0)|
Are you doing some kind of header redirect? Like header("Location: ..."); at any point in your code? If so, then it sounds like at some point all the necessary header information is not being set.
Do you get the "CGI Application Misbehaved ... didn't return the right headers" message? If so, that I believe is an IIS/CGI issue when you run too many CGI applications at the same time. Look at your CPU levels to see if it's running at full capacity at any time.
I would first output the headers and debug the code to make sure there are not any bizarre loops going on or other things that might not get the headers set correctly in the response. Then look into any other pieces of code...you might have an infinite loop going on that is causing other CGI apps to hang. If you were upgrading from PHP 4 to 5 I would say you probably are using deprecated functions/modifiers/etc, but since you are not, there's a good chance it might not be the code. But I would start there first.
It's tough to say without seeing your code and environment. Is it possible not to run PHP as CGI?
| 8:28 pm on Jan 25, 2008 (gmt 0)|
Ok, here's an explanation of the script:
The script is a PHP site I've built on CodeIgnitor. It works perfectly fine under PHP 5.1.2, no CGI errors or anything. The CGI error only occurs when ANY PHP script is called up in the following style:
The environment is a Win 2003 server with PHP running as a CGI module under IIS6. It is possible to run PHP as an ISAPI extension and I'm going to try this next!
| 8:48 pm on Jan 25, 2008 (gmt 0)|
You are using CodeIgnitor? Just hit up the CodeIgnitor forums and see if anyone else is having a similar problem. Sounds like it could be a probelm that others running PHP as CGI might have too.
| 8:59 pm on Jan 25, 2008 (gmt 0)|
Sorry I can't be of more assistance, but in your code also check for any redirects that are happening incorrectly. For instance, are you calling a redirect from your controller? If so, you might also want to consider refactoring this as it breaks the MVC design pattern. The headers need to be outputted in the response before anything else. Usually with header errors, there is data before the server headers in the response. I think with Firebug you can monitor the request/response headers.
| 9:14 pm on Jan 25, 2008 (gmt 0)|
Sorry, one last thing. I have two projects in development both running CodeIgniter and PHP 5.2.5 and have not come across this problem with CI. But I am not running PHP as a CGI ext. So if worst case scenario happens, can you do a standard install of PHP?
| 10:05 pm on Jan 25, 2008 (gmt 0)|
Ah I fixed it. It was because PHP was running under CGI and not under ISAPI! However, AND THIS IS BIG BIG WARNING TO IIS USERS: Please please make sure that when you move from CGI to ISAPI for PHP and you have .NET web sites, make sure that if you have .NET 1 and .NET 2 web sites that you know which ones are which because once you add PHP ISAPI filter, it resets .NET version on SOME (it gives you a list and READ IT!) sites which causes them to go down!
It's all running on lovely ISAPI now! Woo.
| 6:15 pm on Jan 27, 2008 (gmt 0)|
Nice...my favorite quote still about running PHP as CGI:
"You are doing what now?...that's suicide."
| 9:29 pm on Jan 27, 2008 (gmt 0)|
Totally! It was a mistake I made around June 07. I read that the ISAPI extension was still unstable so I installed it as CGI. I'm glad it's all been sorted out now though.