Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP script ending early, no evidence of an error and timeout set to 0

Tags:

php

time for another brain teaser of something I guess is quite rare.

Is there a hard limit in PHP? Or in Apache? I had a script running last night which lasted around 20 hours. Then it just stopped, mid script on a random line with no errors that I could find.

set_time_limit(0); was set in the script but I'm starting to wonder if there is another limit somewhere else for around 20 hours...

any ideas?

Many thanks in advance.

edit: this is run as a wget.

edit2: I am going to look at the memory issue and get back to you, thanks for the help thus far!

edit3: Oh I should point out this script is gathering data and storing it in an array, the longer it is running the more it is storing so yeah, I'm kinda palm facing on the "used up all the memory" answers here...

SOLUTION: Setting a larger memory for the operation fixed this. Thank you everyone.

like image 583
Dorjan Avatar asked Aug 03 '10 09:08

Dorjan


3 Answers

Perhaps PHP runs out of memory after a while.

Consider forcing PHP garbage collection on every iteration of the loop which may reveal some clues. http://php.net/manual/en/function.gc-collect-cycles.php

like image 170
zwip Avatar answered Nov 08 '22 12:11

zwip


problably the php-cli just crashed or your server rebooted. i dont think php is ment to be executed that long

like image 3
Christian Smorra Avatar answered Nov 08 '22 13:11

Christian Smorra


i had a script that ran for several months without a problem. i just had to kill the process to terminate the script. so there's no limit if you have set_time_limit(0); in your code. have you looked at the system and debug logs of your operating system? that may provide further clues why php or apache crashed.

like image 2
bcosca Avatar answered Nov 08 '22 14:11

bcosca