function _drush_environment_check_php_ini

8.0.x environment.inc _drush_environment_check_php_ini()
6.x environment.inc _drush_environment_check_php_ini()
7.x environment.inc _drush_environment_check_php_ini()
4.x environment.inc _drush_environment_check_php_ini()
5.x environment.inc _drush_environment_check_php_ini()
master environment.inc _drush_environment_check_php_ini()

Evaluate the environment before command bootstrapping begins. If the php environment is too restrictive, then notify the user that a setting change is needed and abort.

1 call to _drush_environment_check_php_ini()
_drush_bootstrap_drush_validate in includes/environment.inc
Validate that Drush is running in a suitable environment.

File

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

Code

function _drush_environment_check_php_ini() {
  $ini_checks = array(
    'safe_mode' => '',
    'open_basedir' => '',
    'disable_functions' => array('exec', 'system'),
    'disable_classes' => '',
  );

  // Test to insure that certain php ini restrictions have not been enabled
  $prohibited_list = array();
  foreach ($ini_checks as $prohibited_mode => $disallowed_value) {
    $ini_value = ini_get($prohibited_mode);
    $invalid_value = FALSE;
    if (empty($disallowed_value)) {
      $invalid_value = !empty($ini_value);
    }
    else {
      foreach ($disallowed_value as $test_value) {
        if (strstr($ini_value, $test_value) !== FALSE) {
          $invalid_value = TRUE;
        }
      }
    }
    if ($invalid_value) {
      $prohibited_list[] = $prohibited_mode;
    }
  }
  if (!empty($prohibited_list)) {
    drush_log(dt('The following restricted PHP modes have non-empty values: !prohibited_list. This configuration is incompatible with drush.  !php_ini_msg', array('!prohibited_list' => implode(' and ', $prohibited_list), '!php_ini_msg' => _drush_php_ini_loaded_file_message())), 'error');
  }

  return TRUE;
}