Signal handling, php

Is there a way to catch signals using php script?
I wrote a script that works quite well as linux daemon but for the configuration file reloading, that uses SIGHUP, I can’t find the way to catch it. My temporary solution was restarting the whole service but this isn’t the best way because it forces to reconnect to the remote database, pretty slow, and affects my real-time monitor. By this time I’m missing perl, a lot.
Any ideas?

Check this section of the docs

PHP: Process Control Extensions - Manual

And here is a small example: The Dude – Setting up Signal Handlers in PHP via the PCNTL extension


Fatal error: Call to undefined function pcntl_signal() in /home/carlos/development/php/cnxmond/par.php on line 10

I’m trying to figure out why. I think there’s a flag issue(–enable-pcntl) passed to the ‘configure’ script, but I install my php from the binaries.
I’ll keep searching…

Thanks!


rpm -Uhv /media/SU1030.001/suse/i586/php5-pcntl-5.2.4-11.i586.rpm

:slight_smile: :slight_smile:

thanks to both of you!