Since PHP 4, you can also write command line apps in php. If you have a critical app, and you want to avoid several, or mor than one instance of your app, to run, you can use the following class. It works only on unix and linux operating sytems.
Usage:
<?php
inlude("ProcessHandler.class.php"); if(ProcessHandler::isActive()){ die("Already running!\n";); }else{ ProcessHandler::activate(); //run my app }