Skip to content

Instantly share code, notes, and snippets.

@adduc
Created November 9, 2021 05:45
Show Gist options
  • Save adduc/d58a33c899cf078006b7f00291668477 to your computer and use it in GitHub Desktop.
Save adduc/d58a33c899cf078006b7f00291668477 to your computer and use it in GitHub Desktop.
stacktrace-on-sighup.php
<?php
declare(strict_types=1);
pcntl_async_signals(true);
pcntl_signal(SIGHUP, function ($signal) {
echo "HUP! {$signal} \n";
error_log((new Exception())->getTraceAsString());
});
(new class
{
function __invoke()
{
printf("kill -s HUP %d\n", getmypid());
while (true) {
sleep(255);
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment