Plesk 9.5 IIS 7 Fast CGI timeout error 500 - php

I'm running the following setup:
- Windows 2008 web edition
- IIS 7
- Plesk 9.5
- FastCGI
PROBLEM DESCRIPTION
When running a script that takes longer than 30 seconds, I get the 500 internal server error message and not the "normal" response ("max execution time of 30 seconds is reached"). Also, this message always appears after about 40 secondes. Also, after putting set_time_limit(3600); into the code this same results happen.
ACTUAL RESULT
Both with and without the set_time_limit code:
After about 40 seconds a 500 internal server error appears
EXPECTED RESULT
Without set_time_limit:
After 30 seconds a message will appear saying the 30 seconds max execution limit is reached.
With set_time_limit:
The full script runs with a max of the number of seconds set in the set_time_limit
ADITIONAL NOTE
The problem is solved when running CGI in stead of FastCGI.
Can anybody help me?

I could found some links that could help you. The problem is the activityTimeout of your cgi module.
Increase fastCgi / PHP activityTimeout in IIS7
FastCGI timeout value change
For my, works in summary this.
Open the dos console "cmd" and go to
c:\windows\system32\inetsrv\
then, execute this command, changing the path of your php-cgi.
appcmd set config -section:system.webServer/fastCgi "-[fullPath='C:\php\php-cgi.exe'].activityTimeout:3600"
I hope this help you!

Related

503 timeout on PHP 5.6.31

I have two and more servers running PHP 5.4.45 with same scripts and none of them are doing any issue when calling a script that requires more than 60 seconds to finish.
However, a new server having PHP 5.6.31 is returning 503 timeout, when I run the same script. I tried everything found on the internet from keepAlive to timeout in httpd.conf and in php.ini, I already have
ini_set('memory_limit', '-1');
ini_set('max_execution_time', 5);
Inside the code and all that. Same script same everything just different PHP version on 5.4.45 it works perfectly while on 5.6.31 I always get timeout unless when the full script executes in less than 60 seconds [I don't know where that limit comes from eventhough I changed anything related to 60 from the httpd.conf and php.ini) .
Kindly can you help me troubleshoot.

Long running script causes 500 error. Only unrelated warnings, in log

Here's my file
$start = time();
//sleep(32);//works
//sleep(33);//works
//sleep(36);//500
sleep(46);//500
echo(time() - $start);
Once I get to about 36 seconds, it is more likely that the page will 500 error, but it might run its course, without error. Above 36 or so, and it will 500 every time. But, I just got one to go 44 seconds. So, you see, it's hard to pin down. It definately will go 33 seconds and anyway, I had the host mod php.ini to script execution: 3600. Windows server.
There are no errors, being generated, in the log.
Ok, this turned out to be iis timing out, not php.
iis manager > fastcgi settings > process model > activity timeout
is where you set that. After I raised the limit, from 30 seconds, my script worked fine.

UBuntu, PHP, NGINX, FastCGI, FPM, CodeIgniter Timeout

I need help on resetting server timeout, at present, the php scripts on my linode servers timeout in 50 seconds, i have tried all options to increase the timeout time but nothing helps.
Environment -
Linode VPS
Server OS - UBuntu 12
Nginx
PHP / Fast CGI
apache
My Development is being done with CodeIgniter
I have a test script (test.php), with the following code -
<?php
sleep(70);
die( 'Hello World' );
?>
When I call this script through a browser, I Get a 504 Timeout Error.
I have setup the following -
PHP - set max_execution_time to 300, max_input time to 300
updated NGINX Configuration file with all the timeout variables (proxy, fastcgi etc)
Setup FastCGI to timeout after 600 seconds
Still my script timeouts at 50 seconds, i have reloaded nginx, rebooted vps, but the changes are not reflecting.
Please help me, this issue is turning me mad.
Sincerely,

How to address : The FastCGI process exceeded configured request timeout error: on IIS 7.5

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>
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.
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)
Double click FastCGI Settings
open PHP.EXE listed there
Monitor changes to file php.ini
activity timeout default is 60s - change to 600s or whatever
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.

Php's set_time_limit throws a 500 error?

When I use set_time_limit and the script runs for any amount of time greater than 360 seconds, it throws a 500 error.
359, nothing, 360 and above, error.
I don't have access to php.ini, how can I fix this bug?
script runs for any amount of time greater than 360 seconds, it throws a 500 error.
It sounds like you're hitting another timeout somewhere. If your server uses FastCGI, for example, Apache and/or the FastCGI process could be configured to only wait for six minutes (360 seconds) before timing out. It also could be that there's a reverse proxy sitting between you and Apache with the same timeout, though proxy timeouts are usually 504s, not 500s.
Please examine your server configuration. If you're on shared hosting, ask your host about the timeout.
If your script needs to execute for an extended time, you may wish to find another way to run it.
If you use Apache you can change maximum execution time by .htaccess with this line
php_value max_execution_time 200

Categories