Answer the question
In order to leave comments, you need to log in
PHP Fatal error: Maximum execution time of 30 seconds exceeded in Unknown on line 0
The following entries appear in the logs: “PHP Fatal error: Maximum execution time of 30 seconds exceeded in Unknown on line 0” and the server freezes, does not enter via ssh / ftp, but responds to ping. Has anyone else experienced such miracles? Apache Server/2.2.3 (CentOS), PHP 5.3.10
Answer the question
In order to leave comments, you need to log in
I can assume that your script falls into recursion, gets stuck, Apache starts enchantingly forking to satisfy requests, new processes also get stuck, the system is epochally losing resources (memory and CPU time), a lot is clogged in swap, other processes become incapacitated such like ssh, ftp due to lack of resources. Apache also gets up because fork stops working. After some time, the script is killed by Apache fork by max_execution_time, resources are returned, the sun is getting brighter, the sky is bluer, ssh is faster. Something like this. Total: a very heavy script was detected.
I will supplement the previous post, respected Aco
Judging by the symptom, the system is really terribly short of resources.
- It is far from a fact that if it worked before, then there is no recursion. Error in logic + invalid data = infinite recursion.
What I can advise:
- Play around with memory_limit. It can help find the "weak link" recursion is usually fraught with eating up system resources
And of course, cruel porn debugging at night on a test environment. This is the only way you can understand the logic of someone else's code and find a bottleneck
Look also at the access log, what preceded the fall, what requests. Maybe this will give you some idea.
It is also important to understand the frequency of the problem. This is due to the number of users (respectively, lack of resources) or with the entry of a search robot or with a rare but “accurate” call of some kind of heavy function (for cache re-sausage, importing a large amount of data, etc.)
Try set_time_limit(0);. If it doesn't help, then it could be an infinite recursion.
If you are using apache, then first of all look at the output of top under load, the second is to set mod_status and check which requests are hanging. Then you can see why. So, you can log the execution time of requests (apache allows this)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question