From f85844c4a29b27444f012f09dcf6519cc07a2b31 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Sun, 19 Oct 2014 18:22:16 +0200 Subject: [PATCH] Fix issue if we try to install a extension for a not active php version --- src/PhpBrew/ExtensionInstaller.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/PhpBrew/ExtensionInstaller.php b/src/PhpBrew/ExtensionInstaller.php index bfff774a0..1eb9b5e5f 100644 --- a/src/PhpBrew/ExtensionInstaller.php +++ b/src/PhpBrew/ExtensionInstaller.php @@ -99,7 +99,17 @@ public function runInstall($packageName, $dir, $configureOptions) throw new \Exception('Neither config.m4 nor config0.m4 was found'); } - Utils::system('phpize > build.log'); + $phpizeCommand = 'phpize'; + + $phpizeForVersion = Config::getCurrentPhpDir() + .DIRECTORY_SEPARATOR.'bin' + .DIRECTORY_SEPARATOR.$phpizeCommand; + + if (file_exists($phpizeForVersion)) { + $phpizeCommand = $phpizeForVersion; + } + + Utils::system($phpizeCommand.' > build.log'); // here we don't want to use closure, because // 5.2 does not support closure. We haven't decided whether to @@ -112,6 +122,15 @@ public function runInstall($packageName, $dir, $configureOptions) $this->logger->info("===> Configuring..."); + $phpConfig = $phpizeForVersion = Config::getCurrentPhpDir() + .DIRECTORY_SEPARATOR.'bin' + .DIRECTORY_SEPARATOR.'php-config'; + + + if (file_exists($phpConfig)) { + $escapeOptions[] = '--with-php-config='.$phpConfig; + } + Utils::system('./configure ' . join(' ', $escapeOptions) . ' >> build.log 2>&1') !== false or die('Configure failed.'); $this->logger->info("===> Building..."); @@ -121,9 +140,11 @@ public function runInstall($packageName, $dir, $configureOptions) // This function is disabled when PHP is running in safe mode. $output = shell_exec('make install'); + if (!$output) { throw new \Exception("Extension Install Failed."); } + $this->logger->debug($output); $installedPath = null;