Heh...
Usually I'm answering questions 🙂
Anyway...
Have a PHP script running as a daemon process
since I thought it would be real swell to have PHP servers that can run around and do crap for me 24/7.
The problem is this code here:
while(!$quit) {
if (($child = pcntl_fork()) == -1 ) { $quit++; }
elseif ($child == 0) {
if (empty($sites)) {
$sites[0]['url'] = 'feh';
echo $sites[0]['url']."\n";
$quit++;
exit;
}
exit;
}
}
note the exessesive 'exits()'
...the 'if' statement gets successfully executed 30 times before it exits!
It should only run once.
I know it has something to do with the 'while' loop, but why does the 'if' statement ignore the setting of '$sites'?
And better still... how to stop this and make this thing behave.
And now that I've taken the time to write it out in a lil form field, I'm thinking that 'while' is processing faster than 'if' and thus it execs the statement as true 30x before it catches on that it's supposed to be dead.
Go ahead and post anyway...
I might be wrong still 🙂