PHPBrew: cannot install php or install openssl extension

2k Views Asked by At

I seem to be running around in circles trying to install a version of php using phpbrew. When trying to install any version of php it returns a fatal error:

openssl extension not found, to download releases file you need openssl.

But when I try install openssl via phpbrew it also throws an error saying:

Error: PHPBREW_PHP environment variable is not defined. This extension command requires you specify a PHP version from your build list.

Any help would be much appreciated.

Commands & Output

phpbrew --debug install php-5.6.18 +default

Throws this error:

WARNING: curl extension might be required for fetching data.
Exception: openssl extension not found, to download releases file you need openssl.
Thrown from phar:///usr/bin/phpbrew/src/PhpBrew/ReleaseList.php at line 163:

  160    private static function downloadReleaseListFromOfficialSite($version, OptionResult $options = null)
  161    {
  162        if (!extension_loaded('openssl')) {
> 163            throw new Exception(
  164                'openssl extension not found, to download releases file you need openssl.');
  165        }
  166
  167        $max = ($options && $options->old) ? 1000 : 100;

Trace:
    0) PhpBrew\ReleaseList::downloadReleaseListFromOfficialSite(7, GetOptionKit\OptionResult)
        from phar:///usr/bin/phpbrew/src/PhpBrew/ReleaseList.php: 179
    1) PhpBrew\ReleaseList::buildReleaseListFromOfficialSite(GetOptionKit\OptionResult)
        from phar:///usr/bin/phpbrew/src/PhpBrew/ReleaseList.php: 136
    2) PhpBrew\ReleaseList->fetchRemoteReleaseList(GetOptionKit\OptionResult)
        from phar:///usr/bin/phpbrew/src/PhpBrew/ReleaseList.php: 154
    3) PhpBrew\ReleaseList::getReadyInstance(GetOptionKit\OptionResult)
        from phar:///usr/bin/phpbrew/src/PhpBrew/Command/InstallCommand.php: 182
    4) PhpBrew\Command\InstallCommand->execute('php-5.3.10', '+default')
        from : 0
    5) call_user_func_array([PhpBrew\Command\InstallCommand, 'execute'], ['php-5.3.10', '+default'])
        from phar:///usr/bin/phpbrew/vendor/corneltek/cliframework/src/CommandBase.php: 845
    6) CLIFramework\CommandBase->executeWrapper(['php-5.3.10', '+default'])
        from phar:///usr/bin/phpbrew/vendor/corneltek/cliframework/src/Application.php: 398
    7) CLIFramework\Application->run(['/usr/bin/phpbrew', '--debug', 'install', 'php-5.3.10', '+default'])
        from phar:///usr/bin/phpbrew/src/PhpBrew/Console.php: 111
    8) PhpBrew\Console->runWithTry(['/usr/bin/phpbrew', '--debug', 'install', 'php-5.3.10', '+default'])
        from phar:///usr/bin/phpbrew/scripts/phpbrew-emb.php: 2
    9) require('phar:///usr/bin/phpbrew/scripts/phpbrew-emb.php')
        from /usr/bin/phpbrew: 99

phpbrew --debug ext install openssl

Throws this error:

# WARNING: curl extension might be required for fetching data.
Error: PHPBREW_PHP environment variable is not defined.
  This extension command requires you specify a PHP version from your build list.
  And it looks like you haven't switched to a version from the builds that were built with PHPBrew.
Suggestion: Please install at least one PHP with your prefered version and switch to it.

Platform

OS: Ubuntu 16.04 (Windows Sub-system for linux)

Running PHP: None yet, cannot install.

Installing PHP: Any version of php on phpbrew

1

There are 1 best solutions below

1
On

This is probably a problem with permissions for your .phpbrew folder. It is located in /home in Ubuntu.

You can do it quick and dirty:

sudo chmod -R 777 ~/.phpbrew/

It is not acceptable to do on production, but you are probably safe on your development machine.