How gives an infinite loop

Asked

Viewed 263 times

-3

How do I treat the exception below:

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

  • 2

    In what way the tag php is related to this question? Can you explain further what you want?

  • I’m giving a for with php!

  • 1

    Are you using ajax? do you want the page to be blocked? what is the intention? what situation do you want to give the user?

  • I edited for better understanding forgive ignorance on my part regarding technology!

  • 3

    Could put the code that hangs the browser?

  • 2

    You should not treat any exception. If you know there is one loop infinity even, you must find a way for it to end. As you have not put any code, we have no way to help.

  • 2

    There were people voting that the question was not clear, as you accepted an answer that does not solve the problem described, I am obliged to agree.

Show 2 more comments

1 answer

2


You can solve this using the function set_time_limit PHP. Just pass the execution time of a script in seconds.

This has nothing to do with the browser. The lock does not happen there, but on your server. The default time limit is 30 seconds. When it is exceeded, this error happens. Alternatively, you can change the "max_execution_time" in php.ini.

  • 4

    If there’s a loop infinite, you can put the limit to 1 million that will not solve.

  • 2

    What I understood is that the question was how to make the execution of the script not stop in 30 seconds. For that, there is the answer. If the goal is to solve the loop problem, then just viewing the code to see what is the cause of the loop.

  • 1

    The title is very clear that there is a loop infinity. If you are right, the question is wrong and you have given a kick. The ideal is only to answer what is clear, what is right. You are at risk of getting negatives.

  • I didn’t question the existence of the infinite loop. I also think it’s clear. It turns out that the question was edited recently. I didn’t kick. To increase the time, the procedure is this. The answer is in accordance with the way the question was formulated and it was edited when I answered it. The previous version implied that the author’s intention was to increase the execution time of the script.

  • From the beginning the question was about loop infinite, at no time the question was or is about increasing the running time.

  • I think you’re both right. The question has changed radically with the last two issues. @bigown

Show 1 more comment

Browser other questions tagged

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