| php Programming Glossary: php_sapi_nameWhat is the canonical way to determine commandline vs. http execution of a PHP script? http://stackoverflow.com/questions/173851/what-is-the-canonical-way-to-determine-commandline-vs-http-execution-of-a-php-s  http command line cli   share improve this question   use php_sapi_name . It returns a string and everything other than cli should mean.. 
 In php, how to detect the execution is from CLI mode or through browser? http://stackoverflow.com/questions/1991346/in-php-how-to-detect-the-execution-is-from-cli-mode-or-through-browser 
 How to differentiate between http and cli requests? http://stackoverflow.com/questions/2172970/how-to-differentiate-between-http-and-cli-requests 
 What is mod_php? http://stackoverflow.com/questions/2712825/what-is-mod-php  or via CGI. You might also want to take a look at the php_sapi_name function it returns the type of interface between web server.. 
 PHP: How to send HTTP response code? http://stackoverflow.com/questions/3258634/php-how-to-send-http-response-code  this requires special treatment for Fast CGI PHP sapi_type php_sapi_name if substr sapi_type 0 3 'cgi' header Status 404 Not Found else.. I do not recommend putting a random string there. Note php_sapi_name requires PHP 4.0.1 3rd argument to header function PHP 4.3 There.. 
 Is there any way to know if a php script is running in cli mode? http://stackoverflow.com/questions/607373/is-there-any-way-to-know-if-a-php-script-is-running-in-cli-mode 
 PHP - how to best determine if the current invocation is from CLI or web server? http://stackoverflow.com/questions/933367/php-how-to-best-determine-if-the-current-invocation-is-from-cli-or-web-server  methods  php php cli   share improve this question   php_sapi_name is the function you will want to use as it returns a lowercase.. PHP_SAPI . Documentation can be found here http php.net php_sapi_name For example to determine if PHP is being run from the CLI you.. 
 |