|Hardware Problems | Software Problems|
PHP Gives "CGI Timeout" Error With IIS
Problem: When running a PHP script with IIS a "CGI Timeout" error occurs after 5 minutes.
Operating System: Windows 2000 Professional with service pack 3, IIS 5.0.
Background: The PHP script I was running takes a long time to complete as it was checking and verifying that a large number of web pages exist. It could take an hour or more to complete.
Resolution Steps: I first tried setting the script's time limit with the following PHP code:
But this didn't help. It seemed to me that IIS was killing the script after 5 minutes. I looked in the IIS management console (Start => Settings => Control Panel => Administrative Tools => Internet Services Manager) but couldn't find anything related to the CGI timeout period.
Searching Google Groups I found several people that had this problem but no helpful solutions. One particular MVP (Microsoft Most Valued Professional) insisted that it was impossible for a script to run for more than 5 minutes and said:
I knew this wasn't true as I'd run long executing PHP scripts under Apache before. After much more digging around I finally found where the CGI Timeout was specified. This is how you change it:
The above instructions work for IIS 5.0, which ships with Windows 2000. If you have Windows XP then you've probably got IIS 5.1 and should follow these instuctions:
If you are running Windows Server 2003 then you are running IIS 6.0. Microsoft decided to remove the option to configure the CGI timeout value in IIS 6.0 from the GUI interface. See this article for information on how to set the timeout value in IIS 6.0.
Recommended Reading For PHP Programmers: Programming PHP
Send Feedback to Murray
Copyright © 2001-2015 Murray Moffatt
Did you find my site useful? You can show your thanks
by making your next Amazon purchase through this website.
It won't cost you any extra and Amazon will pay me a small commission.