|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-07-07 21:00 UTC] sniper@php.net
[2002-08-07 02:22 UTC] jeff at tmtrading dot com
[2002-08-08 00:51 UTC] alan_k@php.net
[2002-09-09 01:00 UTC] php-bugs at lists dot php dot net
[2002-10-25 07:45 UTC] vlcc69jfbo001 at sneakemail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 21:00:01 2025 UTC |
function: pcntl_signal() problem: If "handler" argument is set to a user-defined function, that function is never called. script: (taken from www.php.net/pcntl_signal) <?php // signal handler function function sig_handler($signo) { echo "We hit the sig_handler!\n"; switch($signo) { case SIGTERM: // handle shutdown tasks exit; break; case SIGHUP: // handle restart tasks break; case 1: print "Caught sig 1 ...\n"; break; case SIGUSR1: print "Caught SIGUSR1...\n"; break; default: // handle all other signals } } print "Installing signal handler...\n"; // setup signal handlers pcntl_signal(SIGTERM, "sig_handler"); pcntl_signal(SIGHUP, "sig_handler"); pcntl_signal(SIGUSR1, "sig_handler"); print "Generating signal SIGTERM to self...\n"; // send SIGUSR1 to current process id posix_kill(posix_getpid(), SIGUSR1); print "Done\n" ?> The "we hit the sig handler!" echo never appears ... thus I suspect it's never being called.