Shoutbox

PHP Signal handling - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: PHP Signal handling (/showthread.php?tid=83024)

PHP Signal handling by MeEtc on 04-08-2008 at 06:12 AM

I'm experimenting with a PHP-based MSN bot. It runs a background CLI process that pretty much loops forever until it received a TERM signal from a bash script. Right now, the only way of inserting data into the process is for sending of messages. To do that, a file is created in a specific format and CHMODed to 666. The script picks it up on the loop cycle, processes and sends message, then moves file to a backup directory.

What I'm interested in, is if its possible to send raw data to such a running process and be able to process it (and send some back if possible too).

I'm looking at the pcntl_signal() function that registers a callback for when a specific signal is sent to the process (like TERM, which is already in the code), but I have no idea on how to send such a signal either from another PHP script. This function still doesn't take data, but I could at least tell it to go looking for data.

Any thoughts or other suggestions on how to do this?