I am trying to figure out what is internally different about exec between
CLI and mod_php.

If exec() a script from CLI and said script forks, I get my prompt right
back.

test.php
------------
<?php

exec("/home/brianm/fork.php");

?>


fork.php
------------
#!/usr/local/bin/php
<?php

$pid = pcntl_fork();

if ($pid == -1) {
    trigger_error("Could not fork __FILE__", E_USER_ERROR);
    exit();
} elseif($pid>0) {
    exit();
}

touch("/tmp/file.txt");
sleep(5);

?>

However, if I run test.php from mod_php in Apache, the parent zombies and
exec() waits for the forked process to finish.

What is the difference here and is there any hope of having exec in mod_php
work the same as it does in CLI?

Brian Moon
dealnews.com


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to