1
0
Fork 0

Sync up diagnose command with the installer

pull/3804/head
Jordi Boggiano 2015-02-28 20:20:22 +00:00
parent 45b1f356c2
commit d5feea83b6
1 changed files with 85 additions and 15 deletions

View File

@ -343,10 +343,34 @@ EOT
} }
$iniMessage .= PHP_EOL.'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.'; $iniMessage .= PHP_EOL.'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
if (!function_exists('json_decode')) {
$errors['json'] = true;
}
if (!extension_loaded('Phar')) {
$errors['phar'] = true;
}
if (!extension_loaded('filter')) {
$errors['filter'] = true;
}
if (!extension_loaded('hash')) {
$errors['hash'] = true;
}
if (!extension_loaded('ctype')) {
$errors['ctype'] = true;
}
if (!ini_get('allow_url_fopen')) { if (!ini_get('allow_url_fopen')) {
$errors['allow_url_fopen'] = true; $errors['allow_url_fopen'] = true;
} }
if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
$errors['ioncube'] = ioncube_loader_version();
}
if (version_compare(PHP_VERSION, '5.3.2', '<')) { if (version_compare(PHP_VERSION, '5.3.2', '<')) {
$errors['php'] = PHP_VERSION; $errors['php'] = PHP_VERSION;
} }
@ -356,19 +380,13 @@ EOT
} }
if (!extension_loaded('openssl')) { if (!extension_loaded('openssl')) {
$warnings['openssl'] = true; $errors['openssl'] = true;
} }
if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && ini_get('apc.enable_cli')) { if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && ini_get('apc.enable_cli')) {
$warnings['apc_cli'] = true; $warnings['apc_cli'] = true;
} }
if (ini_get('xdebug.profiler_enabled')) {
$warnings['xdebug_profile'] = true;
} elseif (extension_loaded('xdebug')) {
$warnings['xdebug_loaded'] = true;
}
ob_start(); ob_start();
phpinfo(INFO_GENERAL); phpinfo(INFO_GENERAL);
$phpinfo = ob_get_clean(); $phpinfo = ob_get_clean();
@ -384,19 +402,76 @@ EOT
} }
} }
if (ini_get('xdebug.profiler_enabled')) {
$warnings['xdebug_profile'] = true;
} elseif (extension_loaded('xdebug')) {
$warnings['xdebug_loaded'] = true;
}
if (!empty($errors)) { if (!empty($errors)) {
foreach ($errors as $error => $current) { foreach ($errors as $error => $current) {
switch ($error) { switch ($error) {
case 'json':
$text = PHP_EOL."The json extension is missing.".PHP_EOL;
$text .= "Install it or recompile php without --disable-json";
break;
case 'phar':
$text = PHP_EOL."The phar extension is missing.".PHP_EOL;
$text .= "Install it or recompile php without --disable-phar";
break;
case 'filter':
$text = PHP_EOL."The filter extension is missing.".PHP_EOL;
$text .= "Install it or recompile php without --disable-filter";
break;
case 'hash':
$text = PHP_EOL."The hash extension is missing.".PHP_EOL;
$text .= "Install it or recompile php without --disable-hash";
break;
case 'ctype':
$text = PHP_EOL."The ctype extension is missing.".PHP_EOL;
$text .= "Install it or recompile php without --disable-ctype";
break;
case 'unicode':
$text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
$text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
$text .= " detect_unicode = Off";
$displayIniMessage = true;
break;
case 'suhosin':
$text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
$text .= "Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):".PHP_EOL;
$text .= " suhosin.executor.include.whitelist = phar ".$current;
$displayIniMessage = true;
break;
case 'php': case 'php':
$text = "Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher."; $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
break; break;
case 'allow_url_fopen': case 'allow_url_fopen':
$text = "The allow_url_fopen setting is incorrect.".PHP_EOL; $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
$text .= "Add the following to the end of your `php.ini`:".PHP_EOL; $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
$text .= " allow_url_fopen = On"; $text .= " allow_url_fopen = On";
$displayIniMessage = true; $displayIniMessage = true;
break; break;
case 'ioncube':
$text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
$text .= "Upgrade to ionCube 4.0.9 or higher or remove this line (path may be different) from your `php.ini` to disable it:".PHP_EOL;
$text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
$displayIniMessage = true;
break;
case 'openssl':
$text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
$text .= "If possible you should enable it or recompile php with --with-openssl";
break;
} }
$out($text, 'error'); $out($text, 'error');
} }
@ -425,11 +500,6 @@ EOT
$text .= " Recompile it without this flag if possible"; $text .= " Recompile it without this flag if possible";
break; break;
case 'openssl':
$text = "The openssl extension is missing, which will reduce the security and stability of Composer.".PHP_EOL;
$text .= " If possible you should enable it or recompile php with --with-openssl";
break;
case 'php': case 'php':
$text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL; $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
$text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues."; $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";