Php script execution timeout

From vpsget wiki
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



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

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)


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: