destiny
destiny

Reputation: 107

PHP max execution time wrong

One of my PHP scripts is throwing the following error at me:

Fatal error: Maximum execution time of 30 seconds exceeded

The problem is that the script has only been executing for a few seconds.
I've timed everything between 2 and 10 seconds.

set_time_limit and ini_set('max_execution_time') have no effect (because of PHP safe mode). Now I could just increase the value in my php.ini , but I would like to know why this error is thrown within a fraction of the actual maximum execution time.

Upvotes: 1

Views: 226

Answers (2)

Pugazhenthi
Pugazhenthi

Reputation: 90

The set_time_limit() function and the configuration directive max_execution_time only affect the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using system(), stream operations, database queries, etc. is not included when determining the maximum time that the script has been running.

Or You can user set_time_limit(0) it will help only safemode.

Upvotes: 1

Vilsol
Vilsol

Reputation: 722

This means that you might have an infinite loop somewhere or there is some code that has a timeout higher than 30 seconds.

Upvotes: 0

Related Questions