Detect SIGNAL with pcntl functions ?

Clients, Shared hioting running PHP 5.2 (yes 5.2) . Requires a process to close on command. Trying to find ways to avoid “kill -9”

Reading up on sending signals to proceses. I see that a signal can be sent using posix_kill ( $pidOfBackground , SIGUSR1); , but to detect the signal in the receiving process, PCNTL extension is used, which has to compiled in. Something that would not be possible.

Is there any other way to detect a signal in a php process ?

A possible way that comes to mind: Write command to file and in background process, read for command every few seconds. A bad approach ?

The background process runs for 2-10 minutes at max.

submitted by /u/gyaani_guy
[link] [comments]