To detect if your PHP script is being called via a web client or via CLI, you can use the
php_sapi_name function. If you use this simple code:
echo php_sapi_name();
Then from a web browser you will see either fpm-fcgi or cgi-fcgi (depending on PHP handler your site uses) and from CLI you will see cli.
No Comments yet!