function drush_verify_cli

8.0.x environment.inc drush_verify_cli()
6.x environment.inc drush_verify_cli()
7.x environment.inc drush_verify_cli()
3.x drush.php drush_verify_cli()
4.x drush.php drush_verify_cli()
5.x environment.inc drush_verify_cli()
master environment.inc drush_verify_cli()

Verify that we are running PHP through the command line interface.

This function is useful for making sure that code cannot be run via the web server, such as a function that needs to write files to which the web server should not have access to.

Return value

A boolean value that is true when PHP is being run through the command line, and false if being run through cgi or mod_php.

1 call to drush_verify_cli()
drush_bootstrap_prepare in includes/bootstrap.inc
Prepare drush for bootstrap

File

includes/environment.inc, line 572
Functions used by drush to query the environment and setting the current configuration.

Code

function drush_verify_cli() {
  return (php_sapi_name() == 'cli' || (is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0));
}