【问题标题】:PHPBrew: cannot install php or install openssl extensionPHPBrew:无法安装 php 或安装 openssl 扩展
【发布时间】:2017-03-04 17:20:55
【问题描述】:

我似乎在兜圈子,试图使用 phpbrew 安装一个 php 版本。当尝试安装任何版本的 php 时,它会返回一个致命错误:

未找到 openssl 扩展,下载发布文件需要 openssl

但是当我尝试通过 phpbrew 安装 openssl 时,它也会抛出一个错误:

错误:未定义 PHPBREW_PHP 环境变量。此扩展命令要求您从构建列表中指定 PHP 版本。

任何帮助将不胜感激。

命令和输出

phpbrew --debug install php-5.6.18 +default

抛出此错误:

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

抛出此错误:

# 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.

平台

操作系统:Ubuntu 16.04(Linux 的 Windows 子系统)

运行 PHP: 还没有,无法安装。

安装 PHP: phpbrew上的任何版本的php

【问题讨论】:

    标签: php ubuntu-16.04 windows-subsystem-for-linux phpbrew


    【解决方案1】:

    这可能是您的 .phpbrew 文件夹的权限问题。它位于 Ubuntu 的 /home 中。

    你可以做的又快又脏:

    sudo chmod -R 777 ~/.phpbrew/
    

    在生产环境中执行此操作是不可接受的,但您在开发机器上可能是安全的。

    【讨论】:

    • 感谢 TheKitMurkit,我认为问题在于 PHPBrew 的过时版本和我对 WSL 的自定义升级。我最终从创建者更新中重新安装了 WSL,并安装了更新的 PHPBrew,从那时起一切正常。
    猜你喜欢
    • 2016-04-29
    • 1970-01-01
    • 1970-01-01
    • 2017-05-20
    • 2023-02-24
    • 2021-05-28
    • 2015-09-26
    • 2018-11-14
    • 2015-04-28
    相关资源
    最近更新 更多