0

I have array: $stack and function that walks this stack:

private function nextStep()
    {
        echo "Next\r\n";
        return next($this->stack);
    }

I call this functions in infinity loop, but I sure that this array is full until condition then I dont call nextStep anymore.

So, I get error in Fatal error: Maximum execution time of 30 seconds exceeded in private function nextStep()

Whats does it mean and how to fix?

I call this as:

private function parseHTML()
{

   if ($this->nextStep() == false) {

   sleep($this->timeout);
   $this->parse();

   } else {

   $this->parseNextStack();
   }

}

private function currentStack()
{
   $this->currentStackItem = current($this->stack);

}

private function nextStep()
{
   try {
     return next($this->stack);
   }

   catch (Exception $e){

    echo count($this->stack); die();
   }

}

private function parseNextStack(){

   sleep($this->timeout);
   $this->nextStep();
   $this->currentStack();
   $this->parseHTML(); // HERE IS LOOP
}

So, init function is: parseHTML() from that script is started

MisterPi
  • 1,471
  • 5
  • 17
  • 23

1 Answers1

1

If you are sure that loop has correct condition to end it then probably array $stack is too big. You can increase maximum execution time in file php.ini - parameter max_execution_time.