ID: 35244 Updated by: [EMAIL PROTECTED] Reported By: joe dot maldonado at gmail dot com -Status: Open +Status: Feedback Bug Type: Scripting Engine problem Operating System: Linux kernel 2.4.25 PHP Version: 5.0.5 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2005-11-16 17:00:00] joe dot maldonado at gmail dot com Description: ------------ Ran a test script using pcntl_waitpid (below) to see if it could be interrupted via a signal. The result was that the child process was not terminated upon sending the parent a signal. Reproduce code: --------------- #!/usr/local/bin/php -c/usr/local/lib/php.ini <?php declare(ticks = 1); $child_pid = 0; function sig_handler($signo) { global $child_pid; echo "got signal {$signo}\n"; echo "Child pid = $child_pid\n"; if ($child_pid != 0) { posix_kill($child_pid, SIGTERM); } exit(0); } if (!pcntl_signal(SIGTERM, "sig_handler", true)) echo "did not install sigterm\n"; function run_child() { global $child_pid; $child_pid = pcntl_fork(); if ($child_pid == -1) { echo "fork failed\n"; } else if ($child_pid > 0) { echo "parent = " . getmypid() . "\n"; echo "child = {$child_pid}\n"; echo "waiting...\n"; pcntl_waitpid($child_pid, $status); } else { $cmd = "/root/sigchild.sh"; exec($cmd); echo "could not exec child"; } } run_child(); ?> contents of sigchild.sh !/bin/sh sleep 100; echo "done sleeping" Expected result: ---------------- When a SIGTERM is sent to the parent process it should be handled by the signal handler and pass the signal to the child process, then exit. Actual result: -------------- when a SIGTERM is sent to the parent process it is not currently being handled, instead the child will continue to sleep and exit normally. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35244&edit=1