Skip to content

Commit

Permalink
Fix issue if we try to install a extension for a not active php version
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Schneider committed Oct 19, 2014
1 parent 5f46a52 commit f85844c
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/PhpBrew/ExtensionInstaller.php
Expand Up @@ -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
Expand All @@ -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...");
Expand All @@ -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;
Expand Down

0 comments on commit f85844c

Please sign in to comment.