There are certain situations where you want a periodically executed script to have one and only one instance running at a time to prevent against poisoning of data due to simultaneous execution.
There’s actually an extremely simple way to accomplish this in a PHP environment by taking advantage of mySQL’s built in “lock” functionality.
The following simple [...]