|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests |
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 06:00:01 2025 UTC |
Description: ------------ PHP5-CLI: "pcntl_signal" is malfunctioning. It traps the desidred signal(s) but it does not execute the code which is in the custom signal handler! This is very annoying. Reproduce code: --------------- <?php function whatever( $signal ) { echo( "Inside whatever, got $signal\n" ); } pcntl_signal( SIGTERM, 'whatever' ); pcntl_signal( SIGUSR1, 'whatever' ); echo( 'My PID is: ' . getmypid() . "\n" ); // Hard-sleep for 30 secs. time_sleep_until( microtime( true ) + 30 ); echo( "Bye.\n" ); ?> Expected result: ---------------- Start up the provided source code using PHP5-CLI, remember the PID that the script outputs and use "kill -15 <PID>" to send a SIGTERM to it. The script should trap the signal, execute the custom signal handler code and thus output: "Inside whatever, got 15" However, this does not happen. Note that the signal is in fact CAUGHT, because if you remove the handler for SIGTERM and then send a signal 15 to the script, it will self-terminate. Apparently none of the other signals work either (checked with SIGUSR1/2, etc.).