Fatal error: Maximum execution time of 400 seconds exceeded

霸气de小男生 提交于 2019-12-09 03:42:59

问题


I have a PHP script that fails when executing a long mysq_query. The error message is:

Fatal error: Maximum execution time of 400 seconds exceeded in....

I use XAMPP for windows and I have changed the php.ini file (there is only one in my installation), setting max_execution_time to a large value that is not 400 seconds. Nevertheless I keep getting the error message above....

Any idea of how to solve this?

Thanks

Beto


回答1:


As Ignacio says, something may be overriding the php.ini setting. You can definitively set the timeout for that script using set_time_limit

set_time_limit(600);

You can also set it to 0, which removes any time restriction - although this is not best practice.

400 seconds is a huge amount of time for a query - have you looked into adding indexes on commonly used columns in your db?




回答2:


You need to restart your web server for PHP to re-parse your config file.




回答3:


Something in either a .htaccess file or within a PHP script is probably resetting it back to 400 seconds.

Having said that, 400 seconds is still an excessive amount of time for a query. You should consider farming the task off to another process if it really needs to take that long.



来源:https://stackoverflow.com/questions/2131959/fatal-error-maximum-execution-time-of-400-seconds-exceeded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!