When running nginx with php-cgi (Fast-CGI):
spawn-fcgi -a 127.0.0.1 -p 10081 -C 50 -u nobody -f /usr/local/php5317/bin/php-cgi
The Request::cli() method will determine the web request as run from the command line.
Add ` PHP_SAPI != "cgi-fcgi" ` to resolve it.