My PHP script executes some program on my server IIS 7.5
Takes time about 10 mins to execute but above error in browser.
How to resolve this.
Error:
HTTP Error 500.0 - Internal Server Error
C:\php\php-cgi.exe - The FastCGI process exceeded configured request timeout
Module FastCgiModule
Notification ExecuteRequestHandler
Handler FastCGI
Error Code 0x80070102
php.ini settings:
fastcgi.impersonate = 1
fastcgi.logging = 0
cgi.fix_pathinfo=1
cgi.force_redirect = 0
max_execution_time = 0
upload_max_filesize = 20M
memory_limit = 128M
post_max_size = 30M
C:\Windows\System32\inetsrv\config\ applicationHost.config file settings for fast-cgi
<fastCgi>
<application
fullPath="C:\php\php-cgi.exe" activityTimeout = "3600" requestTimeout = "300" />
</fastCgi>
There is one more setting I found from this source that helped me with the same problem I was having. Copied and pasted:
Open Server Manager
At Server Level (not default Web site)
This is sort of a quick explanation of what is going on. When you are using a CGI/FCGI configuration for PHP. The webserver (in this case IIS), routes requests that require php processing to the PHP process (which runs separately from the web server).
Generally, to prevent connections from getting stuck open and waiting (if php process happens to crash) the web server will only wait a set amount of time for the PHP process to return a result (usually 30-60 seconds).
In your configuration you have this:
requestTimeout = "300"
300 seconds = 5 minutes. IIS will cancel the request since your request takes 10 minutes to complete. Simple fix, increase the timeout to something 600 or greater.
Now, running a script for 10 minutes with an http request is not a good design pattern. Generally, http works best with short lived requests. The reason is that timeouts can exist in any part of the process (server, proxy, or client) and the script could be accidentally interrupted.
So, when you have a web application that has a long running job like this, the best way to run it is via console or job queue.
This can be solve by adjusting fast-cgi configuration. Goto "C:\Windows\System32\inetsrv\" and edit "fcgiext.ini" file
[PHP]
ExePath=C:\xampp\php\php-cgi.exe
MonitorChangesTo=C:\xampp\php\php.ini
ActivityTimeout=3600
IdleTimeout=3600
RequestTimeout=3600
Make sure to place ActivityTimeout,IdleTimeout & RequestTimeout inside [PHP] section as shown above.
User contributions licensed under CC BY-SA 3.0