【问题标题】:Install ssh2 extension having homebrew and php 7.3安装具有自制软件和 php 7.3 的 ssh2 扩展
【发布时间】:2019-08-11 07:09:20
【问题描述】:

我在尝试使用 pecl 安装 ssh2 扩展时遇到以下错误:

17 warnings and 3 errors generated.
make: *** [ssh2_fopen_wrappers.lo] Error 1
ERROR: `make' failed

这是我所做的:

brew install php
brew install libssh2
pecl install ssh2-1.1.2

安装 php 7.3.3, libssh2 1.8.0 安装 ssh2-1.1.2 失败。
有没有人有解决这个问题的方法?谢谢!

相关链接:
https://github.com/docker-library/php/issues/767
Install PECL SSH2 extension for PHP

【问题讨论】:

    标签: homebrew pecl libssh2 php-7.3 ssh2


    【解决方案1】:

    我原来的答案:SSH2 for PHP7 MacOS?

    我终于在 MacOS Mohave 上找到了解决方案。我有 Homebrew 安装的 PHP 7.3:

    brew install php
    brew install libssh2
    

    从最新来源安装 ssh2 pecl 扩展的开发版本:

    cd ~/Downloads
    git clone https://git.php.net/repository/pecl/networking/ssh2.git
    cd ssh2
    phpize
    ./configure
    make
    make install
    

    php.ini 中启用扩展。您可以使用文本编辑:

    open -e /usr/local/etc/php/7.3/php.ini
    

    在文件开头添加extension="ssh2.so"并保存。

    测试结果:

    php -i | grep libssh2
    

    你应该看到

    libssh2 version => 1.9.0
    

    【讨论】:

      【解决方案2】:

      您可以使用this answer about docker

      brew install libssh2-1-dev
      
      cd /tmp && git clone https://git.php.net/repository/pecl/networking/ssh2.git && cd /tmp/ssh2
      
      phpize && ./configure && make && make install
      
      
      echo "extension=ssh2.so" > /usr/local/etc/php/conf.d/ext-ssh2.ini
      
      rm -rf /tmp/ssh2
      

      【讨论】:

        【解决方案3】:

        尝试安装libssh2-1-dev

        brew install libssh2-1-dev
        

        更新pecl

        pecl channel-update pecl.php.net
        

        然后安装ssh2-1.1.2

        brew install ssh2-1.1.2
        

        这对我来说是这样的

        【讨论】:

        • 感谢您的回答!不幸的是,我没有 apt-get,因为我使用的是 Mac OS。
        • 然后使用brew安装libssh2-1-dev
        • 不幸的是,brew中没有这样的公式。
        • 在这种情况下,我建议从他们的网站上获取 tar 并自己编译文件。
        猜你喜欢
        • 2020-10-01
        • 2010-10-08
        • 1970-01-01
        • 1970-01-01
        • 2021-12-23
        • 2011-12-13
        • 2012-04-10
        • 2012-07-28
        • 2021-04-10
        相关资源
        最近更新 更多