Fatal error: Maximum Execution

Asked

Viewed 327 times

-2

I had an error running a code in Php

Fatal error: Maximum Execution time of 30 Seconds exceeded

$validade = mysql_query($sql) or die (mysql_error());

The code works perfectly. Except I get this code at the end. Not that it bothers me but only to try to solve

the Loop:

For ($contador = 0; $contador = 1; $contador++){
  • 2

    If you simply increase the time limit will solve the error message, but you will be masking the real problem, you have to figure out which is the heavy process and try to optimize it, because if you leave so can be sure you will have overload problems on the server, which may even result in suspension of service...

  • 1

    @Jader is right. You can put your query here, maybe there is the error.

  • 1

    Looking at your previous questions, I believe the problem is the query: http://answall.com/questions/28815/mostrar-query-problema-ids-different

  • It looks like an endless loop error... Didn’t return the line?

  • Single possible loop For ($counter = 0; $counter = 1; $counter++){

  • It’s the same loop, see how to assemble a loop for, you have not informed what the criteria of your loop.

Show 1 more comment

3 answers

5

I find it strange to say that the code works perfectly, because it gives a "fatal error" which means that the engine stopped processing the script due to an error. And it says he stopped processing because it takes more than 30 seconds to execute. Very few people have the patience to wait half a minute for server response. So I think it’s best to see where the problem is that makes the script take so long to run, rather than allowing more execution time.

1

Your loop is wrong.

In the second parameter of for utilize == instead of =.

The way you did it is always changing the value of the variable $contador to 1 and never leaves the for, generating an infinite loop.

for($contador = 0; $contador == 1; $contador++){

0

Your code is taking more than 30 seconds to run!

You can increase the running time limit with the function set_time_limit(seconds).

Browser other questions tagged

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