From 534fe361492d83a9e19a78580f16337bd2deefb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Kopras?= Date: Wed, 28 Nov 2012 21:26:58 +0100 Subject: [PATCH] Added php.ini path to error message #1052 --- src/Composer/Downloader/ZipDownloader.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Composer/Downloader/ZipDownloader.php b/src/Composer/Downloader/ZipDownloader.php index 027d63033..7a9fcdc92 100644 --- a/src/Composer/Downloader/ZipDownloader.php +++ b/src/Composer/Downloader/ZipDownloader.php @@ -34,7 +34,17 @@ class ZipDownloader extends ArchiveDownloader protected function extract($file, $path) { if (!class_exists('ZipArchive')) { - $error = 'You need the zip extension enabled to use the ZipDownloader'; + // php.ini path is added to the error message to help users find the correct file + $iniPath = php_ini_loaded_file(); + + if ($iniPath) { + $iniMessage = 'The php.ini used by your command-line PHP is: ' . $iniPath; + } else { + $iniMessage = 'A php.ini file does not exist. You will have to create one.'; + } + + $error = "You need the zip extension enabled to use the ZipDownloader.\n". + $iniMessage; // try to use unzip on *nix if (!defined('PHP_WINDOWS_VERSION_BUILD')) { @@ -44,6 +54,7 @@ class ZipDownloader extends ArchiveDownloader } $error = "Could not decompress the archive, enable the PHP zip extension or install unzip.\n". + $iniMessage . "\n" . 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput(); }