Skip to content

Instantly share code, notes, and snippets.

View mlasker's full-sized avatar

Mark mlasker

View GitHub Profile
<?php
/**
* This is small demonstration of PHPs signal handling behavior.
*
* Both methods will fork children using pcntl_fork and output whether or not forked parent/child were created inside
* of the registered sigHandler function, if it's the child or parent, and their respective PIDs.
*
* If you run spawnChildInsideHandler and attempt to send a SIGTERM (15) to either of the two processes
* you will receive no response. To exit you will have to force kill with SIGKILL (9)