I ended up working out a solution using exec:
exec( "/usr/bin/php my_other_php_script.php arg1 arg2 arg3 &").
(passed some data to the other script on the commandline).
thanks, -John
On Wed, 26 Jan 2005, Ben Ramsey wrote:
John Davin wrote:Isn't there any other way to fork a process? PHP doesn't have thread support? Why isn't pcntl enabled by default?
Surely the Windows compatibility isn't an issue, because pcntl could default to enabled in linux but disabled in windows.
I'll tell you what I'm trying to do, in case there's another way to do it: I have a logging script which does a gethostbyaddr to obtain the hostname of the visitor to my site. But gethostbyaddr can take long or time out on some IP's, so I want to fork it so that the original script can terminate and not prevent the webpage from loading.
I could run a background job which periodically does the gethostbyaddr on the IP's stored on disk, but that's sort of a hack, and is more complicated than if I could fork.
Sounds like passthru() might do what you want <http://us3.php.net/passthru>. Take a look at that manual page and read the first note about leaving the program running in the background.
-- Ben Ramsey Zend Certified Engineer http://benramsey.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php