Doubt about Maximum Execution time

Asked

Viewed 241 times

2

Well, I have a system that runs in php, and in it I have several functions. As it is a network system several people use it at the same time. But I started getting the following error log:

PHP Fatal error:  Maximum execution time of 30 seconds

From what I noticed I can increase the limit in PHP.ini

But my question is the following, and normal happen this mistake by tar multiple users using? increase the limit and a gambiarra or has to be done as it has more users?

1 answer

4


Add set_time_limit(0); at the top of the script that is occurring the problem

The documentation says that in safe mode this does not work, but if your php is updated maybe there is no more safe mode, since it is obsolete since PHP 5.3 and has been removed in PHP 5.4, so set_time_limit(0); will work, unless the server administrator blocks this function

I don’t think it’s good to adjust php.ini, because the 30 seconds are from my point of view useful to avoid "bottlenecks".

Question:

But my question is the following, and normal happen this mistake by tar multiple users using?

Answer:

It’s not directly related, this is probably something in your script, if it accesses an external service and the service takes a while (like a webservice or a database) this can occur, but usually the increase is a few seconds, if the problem is occurring is because the script has already spent more than it should and the influence of many accesses only affects it due to the script being "misspelled" (don’t get me wrong)

Documentation: http://php.net/manual/en/info.configuration.php#ini.max-Execution-time

  • well some functions does several select in the database. This may be?

  • @Hugoborges can be, it can be a very large array that you generate making the memory usage be larger (this usually affects only a few seconds), it can be a giant loop that you didn’t even notice. Just looking at the script to say.

  • 2

    was a problem in my select, it listed everything hahaha. I put a LIMIT

Browser other questions tagged

You are not signed in. Login or sign up in order to post.