You can use this function also to avoid more than one instance of your app.
You can also use this class.
http://www.pure-php.de/node/20
Usage:
<?php
inlude("ProcessHandler.class.php");
if(ProcessHandler::isActive()){
die("Already running!\n";);
}else{
ProcessHandler::activate();
//run my app
}
?>