I am unable to change my max execution time. I have changed it in my php.ini file and it still shows as 300 when I run phpinfo() even though I've set it to 0 and even ridiculous amounts (9000000000) Is there a setting I'm missing? I've rebooted the apache server and rebooted the actual server and I am still encountering this issue.
-
3There's usually 2 .ini files. one for SAPI (webserver) based operation, and one for command line operation. phpinfo()'s output will tell you which one(s) is being used. Make sure you're modding the right one. – Marc B Jun 19 '12 at 22:38
-
Also check that there's no .htaccess files with `php-value` overrides, or `ini_set()` somewhere in your script chain that could be overriding the .ini values. – Marc B Jun 19 '12 at 22:43
-
I'm actually running a mysql source command and hitting the limit. phpinfo from command line (echo "" | php > phpinfo.txt) tells me that the cli/php.ini file is used there, but I have also set that one to 0 and it continues to give me this issue... – Jun 19 '12 at 22:45
-
`ltrace` the `php` execution and see for certain if the interpreter is actually reading that setting... – sarnold Jun 19 '12 at 22:47
-
Are there any errors or warnings in logfiles? – sarnold Jun 19 '12 at 22:48
-
Other than the fatal error about max execution time, no. Do you mean run ltrace on the mysql -u
-p -h localhost – Jun 19 '12 at 22:51< data.sql? -
phpinfo() show 2 values: global (php.ini) and local (htaccess, script, etc...) – Igor Parra Jun 19 '12 at 22:54
-
@NomikOS This is through a mysql command and not through a site. I'm not sure that .htaccess would apply for this particular thing. – Jun 19 '12 at 22:56
3 Answers
I ended up using the script on this post https://stackoverflow.com/a/7700253/815437 along with standard ini_set of memory limit and max execution time. This was not a solution to the underlying problem, but it did get me rolling for now.
I am still accepting answers on this problem though because I'm sure it'll be an issue in the future with some large databases I have to import.

- 1
- 1
Try adding this line of code:
set_time_limit(5);
This code sets the max execution time to 5 seconds and you can't set max execution time to 0 because that means that the script will run forever. You have to try a positive number, zero will make the script run forever.

- 142,182
- 29
- 220
- 220

- 43
- 1
- 6
The best way to deal with execution time issues is to enforce max execution time temporarily for that specific script. It's debatable but works fine as balanced solution.
Please read more about it

- 122
- 1
- 12