Possible Duplicate:
What is the canonical way to determine commandline vs. http execution of a PHP script?
I sometimes run php scripts from command line. Either with cron or other one time scripts.
I would like to know if its possible within the php script to determine if its being run via command line?
<?php
$isRunFromCommandLine = // set to (true:false) -- not sure how to do this
if($isRunFromCommandLine){
echo 'You are running from command line';
}
else{
echo 'You are not running php via command line'
}
?>