Php script execution timeout

From vpsget wiki
Revision as of 12:36, 12 September 2014 by Vq (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In order to increase php script execution timeout you need to check the following.

Find php.ini location

php -i | grep php.ini

Set

max_execution_time
max_input_time
max_input_vars

Also check for any .htaccess files in your website folders - they could override the default settings

To check loaded php setting just grep what you need from php -i outuput. Like:

php -i | grep max

You are able to override the default settings inside php script. Example:

ini_set('max_execution_time', 8000); //300 seconds = 5 minutes
set_time_limit(8000);

Also if you still can't force php to increase values, check the error and access httpd/apache logs for the details. You need to check all the included apache conf files. Also you can increase the Timeout in apache/httpd config file. Remember to restart Apache to apply the changes

You can see the differ script execution timeouts sometimes when you run script from the server like:

php <scriptname>.php

and when you load it from browser (or wget from console)

wget http://host.com/script_timeout_test.php

In this case you need to check for the FcgidIOTimeout setting under <IfModule mod_fcgid.c> You can find it like:

grep "<IfModule mod_fcgid.c>" -R /etc/httpd/conf/*
/etc/httpd/conf/includes/pre_virtualhost_global.conf:<IfModule mod_fcgid.c>

and edit /etc/httpd/conf/includes/pre_virtualhost_global.conf, add the next:

FcgidIOTimeout 600

Remember to restart httpd


Also the next values in pre_virtualhost_global.conf could affect on script execution timeouts:

IPCCommTimeout 
IPCConnectTimeout 
IdleTimeout 
FcgidBusyTimeout

""