0

I have a PHP script and this script loops thousands of lines. When I run the PHP file manually, this loop of thousands of lines returns successfully. But when a cron job does this, it turns around 143 times.

What have I checked:

  • I checked if there was something to stop my code for the 143rd time.
  • I checked if this is a timeout. Even if I extend the time, it stops after the 143rd turn.

What have I tried?:

  • I thought it might be a memory issue. and I increased the memory_limit. - Not working

Edit: Even though I didn't make any changes, the situation improved. I need to know the reason for this. Please give your estimates and the measures I can take.

Dave M
  • 4,494
  • 21
  • 30
  • 30
Burak.H
  • 5
  • 2

1 Answers1

1

When you run the file manually, do you run it into a browser or in a console ? Running the php script using Cron, it use the CLI version of PHP instead of the CGI version and timeout configurations are differents between these two versions.

Check the CLI timemout of PHP on the server or add set_time_limit(xxx) on the beginning of your script.

Mystral
  • 11
  • 2