Re: php 5 upgrade and background script on unix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




don't fork webserver processes, granted it doesn't fix the problem, but you really
should be doing it anyway.

I'm guessing that the pcntl extension is not compiled into the webserver php SAPI,
it's a really big guess because you didn't supply the code you use to do the forking with.

Ok then you want to have the fork code!
I'm doing a complete example
====================

My script is forking on itself.
So from my browser I go on:
http://localhost/test_fork.php

My code in test_fork.php is :

<?
$in = get_shell_args($_SERVER['argv']); // DONT PAY ATTENTION TO THAT FUNCTION, it a made home function

if($in['bg']) {
print "HERE"; sleep(30);
}
else {
   print "forking";
`/usr/local/bin/php /www/admin.gammacash.com/test/test_fork.php bg=1 2>&1 /var/log/test.log &`
}
?>

So Im assuming that the fork will get the bg argument, in this case I should receive "HERE" in /var/log/test.log (did tail -f /var/log/test.log while I was running the script)
I've put a sleep 30 seconds to get the fork PID number.

Unfortunately, when I do execute test_fork.php from the web, it wont execute itself in background.
This method was running fine with my old config.

The script works perfectly because if Im executing test_fork.php from the shell, the fork is working fine!


__________ NOD32 2162 (20070402) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com





--
Frederic Belleudy
Programmer
PWIdeas
ICQ #: 253-372-030
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux