I tried things like $_ENV[\'CLIENTNAME\'] == \'Console\' but that seems to work on only certain OS\'s (worked in windows, not linux).
I tried !empty($_ENV[\'SHELL\']) b
One solution is to check whether STDIN is defined:
if (!defined("STDIN")) { die("Please run me from the console - not from a web-browser!"); }