If you are interested in using file locking as indicator that your console app is running and you don't want to start it again:
if (!flock($fp, LOCK_EX | LOCK_NB, $wouldblock)) {
if ($wouldblock) {
//Another process holds the lock!
} else {
//Couldn't lock for another reason, e.g. no such file
}
} else {
//Lock obtained
startJob();
}
Please note that this is platform independent solution, but you have restrictions in PHP version (5.5.22 on Windows).
Also, some old file systems are not supported.