Was a Php Script Called From Command Line
Posted:
Friday, April 27th, 2012Last modified:
Tuesday, May 5th, 2015Overview
How to tell if a PHP script was called from the command line.
<?php if (php_sapi_name() === 'cli' ) { print 'This script was called from the the command line.'; } else { print 'This script was NOT called from the command line.'; } ?>
Available Wiki Topics
The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.