PHP code example of mkraemer / react-pcntl
1. Go to this page and download the library: Download mkraemer/react-pcntl library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mkraemer / react-pcntl example snippets
$loop = React\EventLoop\Factory::create();
$pcntl = new MKraemer\ReactPCNTL\PCNTL($loop);
$pcntl->on(SIGTERM, function () {
// Clear some queue
// Write syslog
// Do ALL the stuff
echo 'Bye'.PHP_EOL;
die();
});
$pcntl->on(SIGINT, function () {
echo 'Terminated by console'.PHP_EOL;
die();
});
echo 'Started as PID '.getmypid().PHP_EOL;
$loop->run();