function drush_verify_cli

8.0.x drush_verify_cli()
6.x drush_verify_cli()
7.x drush_verify_cli()
3.x drush.php drush_verify_cli()
4.x drush.php drush_verify_cli()
5.x drush_verify_cli()
master 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_preflight_prepare in includes/
Prepare Drush for preflight.


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


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