Question

This is a bit esoteric and it's possible this question will go unanswered until I troll the the source myself and answer it, but here goes:

I'm the author of a simple PHP Daemon library: https://github.com/shaneharter/PHP-Daemon. While PHP isn't ideal for this sort of thing, sometimes people need to daemonize or write crons in PHP and wrote the library to make that task a lot easier on the "uninitiated."

I'm implementing the JavaScript Workers API for the library and I'm considering adding a dependency on POSIX (right now it's doing everything with PCNTL).

Does anybody know what the difference is between PCNTL_SIGNAL and POSIX_KILL? I can use either to send any signal to any process. So.... is one better than the other? Or are they both really doing the same thing under the hood?

Was it helpful?

Solution

posix_kill() is used to send a signal to a process.

pcntl_signal() is used to listen for signals received by the calling process (your script).

See the examples here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top