PHP script crashing apache after a few hours...
Posted: Sun Jan 29, 2006 11:22 am
Hi again fellas, wazzup?
lol... I've been coding like a fr3@k lately, non stop, and well, here's my dilemma of the day.....
I have this script that parses a very large file, and it's got plenty of them, after it finishes one ( takes maybe 20-30 minutes each ) it goes to the next one. Problem is, after it's running for a few hours, apache crashes.
I have been wanting to get it translated into c and run it in the background 24/7, but i don't know enough c and the people at vbforums are NOT very helpful, lol, posted a thread last week and been viewed only 13 times no replies......
So what can I do to make this php script more efficient and or not crash, or break it up into multiples......
Like would it have any effect if I cleaned unset() all the variables at the end of each for loop or would that not matter, since at the beginning of each for loop all the variables are set equalt to default ?
Also, is there a possible way to say, I make the php script only run ONCE, can I multithread it's foor loop or is PHP a single threading language where c is multithreaded ?
I need to give it a base of like 100-1000 LARGE root files to parse and shred each day, and basically it's going to take ALL day or longer to do that, maybe it only gets a few hundred files done a day maybe more or less.....
I need to find a way that it keeps going, like if apache crashes after 2 hours, and it only finished 5-10 files, it's not going to do anything for the rest of the time. How can I make it so I have MULTIPLE instances of it running (in the background of course) or something of that nature? \
I've been trying to figure this out on my own for the past week or two but I can't quite see the alog to code in php and what will run it , cron ? I mean I was thinking to integrate cron to run the php script every so often, but i'm not sure how well that will work, and of course, LIST.txt is the LIST of 100-1000 large files it's got to parse and do it's trick to...
Thanks in advance!
lol... I've been coding like a fr3@k lately, non stop, and well, here's my dilemma of the day.....
I have this script that parses a very large file, and it's got plenty of them, after it finishes one ( takes maybe 20-30 minutes each ) it goes to the next one. Problem is, after it's running for a few hours, apache crashes.
I have been wanting to get it translated into c and run it in the background 24/7, but i don't know enough c and the people at vbforums are NOT very helpful, lol, posted a thread last week and been viewed only 13 times no replies......
So what can I do to make this php script more efficient and or not crash, or break it up into multiples......
Like would it have any effect if I cleaned unset() all the variables at the end of each for loop or would that not matter, since at the beginning of each for loop all the variables are set equalt to default ?
Also, is there a possible way to say, I make the php script only run ONCE, can I multithread it's foor loop or is PHP a single threading language where c is multithreaded ?
I need to give it a base of like 100-1000 LARGE root files to parse and shred each day, and basically it's going to take ALL day or longer to do that, maybe it only gets a few hundred files done a day maybe more or less.....
I need to find a way that it keeps going, like if apache crashes after 2 hours, and it only finished 5-10 files, it's not going to do anything for the rest of the time. How can I make it so I have MULTIPLE instances of it running (in the background of course) or something of that nature? \
I've been trying to figure this out on my own for the past week or two but I can't quite see the alog to code in php and what will run it , cron ? I mean I was thinking to integrate cron to run the php script every so often, but i'm not sure how well that will work, and of course, LIST.txt is the LIST of 100-1000 large files it's got to parse and do it's trick to...
Thanks in advance!