【问题标题】:Ubuntu pecl install pecl_http failUbuntu pecl 安装 pecl_http 失败
【发布时间】:2014-11-11 14:55:29
【问题描述】:

我正在尝试安装此扩展程序,但在配置阶段失败。我在 ubuntu 12.04 上,我刚刚安装了这些软件包:

  • libcurl3-openssl-dev
  • php-http
  • libpcre3-dev
  • libcurl3
  • php-梨
  • php5-dev

PHP版本:

PHP 5.3.10-1ubuntu3.14 with Suhosin-Patch (cli) (built: Sep  4 2014 07:08:49) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

这里是安装命令的日志:

sudo pecl install pecl_http
downloading pecl_http-2.1.1.tgz ...
Starting to download pecl_http-2.1.1.tgz (158,441 bytes)
.................................done: 158,441 bytes
64 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
Enable extended HTTP support [yes] : 
where to find zlib [/usr] : 
where to find libcurl [/usr] : 
where to find libevent [/usr] : 
building in /tmp/pear/temp/pear-build-rootqE2kgU/pecl_http-2.1.1
running: /tmp/pear/temp/pecl_http/configure --with-http --with-http-zlib-dir=/usr --with-http-libcurl-dir=/usr --with-http-libevent-dir=/home/gare88/Lib/Php/libevent-2.0.21-stable/
checking for grep that handles long lines and -e... /bin/grep

[... cut...]

checking for zlib.h... found in /usr
checking for zlib version >= 1.2.0.4... 1.2.3.4
checking for curl/curl.h... found in /usr
checking for curl-config... found: /usr/bin/curl-config
checking for curl version >= 7.18.2... 7.22.0
checking for SSL support in libcurl... yes
checking for openssl support in libcurl... no
checking for gnutls support in libcurl... no
checking for ares support in libcurl... no
checking for bundled SSL CA info... /etc/ssl/certs/ca-certificates.crt
checking for event2/event.h... not found
configure: WARNING: continuing without libevent support
checking for ext/raphf support... no
configure: error: Please install pecl/raphf and activate extension=raphf.so in your php.ini
ERROR: `/tmp/pear/temp/pecl_http/configure --with-http --with-http-zlib-dir=/usr --with-http-libcurl-dir=/usr --with-http-libevent-dir=/usr' failed

这似乎是 pecl/raphf 的问题,所以我尝试了:

sudo pecl install raphf
pecl/raphf is already installed and is the same as the released version 1.0.4
install failed

位于 /etc/php5/apache2/php.ini 的 php.ini 文件的末尾 我添加了一行:

extension=raphf.so
extension=propro.so
extension=http.so

还有什么我可以尝试的吗?

【问题讨论】:

标签: php ubuntu pecl


【解决方案1】:

您需要从包管理器中安装 php-raphf。

对我来说,我使用以下方法安装了模块。在您的情况下,您应该能够将 yum 换成 apt-get。

sudo yum install php-raphf
sudo yum install php-propro
sudo pecl install pecl_http

您需要将 extension = http.so 添加到您的 php.ini 文件中。但看起来你已经这样做了。

pecl 并未实际安装您要查找的 .so 文件。

【讨论】:

  • 好吧,问题似乎是 .so 文件丢失(我试过 find 没有结果)。我要下载它。谢谢
  • 太棒了,很高兴它看起来对你有用,如果你必须为安装过程更改任何内容,请告诉我,以便我可以为其他人更新答案:)
  • ubuntu 在标准存储库中没有 raphf 或 propro 扩展,至少在精确上是这样。我已经从 pecl 安装了它们,.so 文件就位,PHP 在php -m 输出中显示它们,但 pecl_http 仍然无法以同样的方式安装。
  • 没有可用的包 php-raphf。
【解决方案2】:

如果您有 ubuntu 13 或 14,请尝试 pecl install pecl_http-1.7.6,因为由于某种原因,较新的版本仍然无法加载。

【讨论】:

  • 你确定它没有被加载,还是你认为它没有被加载,因为版本 1 提供的每个(?)类/函数在版本 2.x 中都被删除了。可以在此处找到版本 2 的文档:mdref.m6w6.name/http
  • @David 我确信它没有出现在几个不同 Linux 发行版上加载的 php 扩展中
【解决方案3】:

在 Ubuntu 12.04.5 LTS 上这对我有用:

首先安装一些编译需要的先决条件:

sudo apt-get install php-http
sudo apt-get install php5-dev
sudo apt-get install libcurl3
sudo apt-get install libpcre3-dev
sudo apt-get install libcurl4-openssl-dev
sudo pecl install raphf 
sudo pecl install pecl_http-1.7.6

然后转到文件夹 /usr/lib/php5/modules 并检查库是否存在:raphf.sopropro.sohttp.so

如果您的 php.ini/etc/php5/apache2/php.ini/etc/php5/cli/php.ini)不包含这些扩展,请添加它们:

extension=http.so
extension=propro.so
extension=raphf.so

或使用文件的绝对路径,例如extension=/usr/lib/php5/modules/http.so.

最后一步重启你的网络服务器,从而加载新的配置:

sudo service apache2 reload

【讨论】:

  • 文档说明 propro.so 和 raphf.so 应该在 php.ini 文件中的 http.so 之上
  • 罪魁祸首是php-dev. Use sudo apt-get install php-dev`,以确保为从命令行运行php 时调用的相同php 版本安装开发工具。
  • 在 Ubuntu 18.04 上试过这个。在尝试了所有这些之后,我发现我在 zlib 上遇到了一个错误,并且发现我缺少开发包。我安装了它,然后 pecl_http 成功完成。 apt-get install zlib1g-dev
【解决方案4】:

只是为了添加到@mschuett 的答案,我发现当我遇到与 OP 相同的错误时,在 php.ini 中更改我的扩展引用就可以了。

extension=raphf.so

extension=/usr/lib/php5/20121212/raphf.so

然后

sudo pecl install pecl_http

当 pecl 安装想要修改 php.ini 文件时,还可以设置以下内容:

pear config-set php_ini /etc/php5/apache2/php.ini
pecl config-set php_ini /etc/php5/apache2/php.ini

注意:这适用于 Ubuntu 14.04 LTS。

【讨论】:

    【解决方案5】:

    运行命令

    1. sudo yum install php-raphf

      • sudo yum install php-propro
    2. sudo pecl install pecl_http

    3. etc/phph5/apache2/conf.d

    添加两个文件

    • raphf.ini

    添加内容

    extension=raphf.so

    solr.ini

    添加内容

    extension=raphf.so

    在 php.ini 文件中添加

    extension=http.so 扩展=propro.so 扩展=raphf.so 要么 扩展=/usr/lib/php5/20121212/raphf.so extension=solr.so

    【讨论】:

      【解决方案6】:

      我在尝试在 Ubuntu 16.04 和 php-fpm5.6 上安装 pecl_http-2.6.0、raphf-1.1.2 和 propro-1.0.2 时遇到了这个问题。我不能使用apt 安装raphf 和propro(如@mschuett 建议的那样),因为apt 只能安装仅适用于PHP 7 的raphf 2.0.0 和propro 2.1.0。

      我通过以下步骤解决了问题,无需更新 php.ini 也无需使用 apt

      首先,要让 php-fpm 加载新的扩展,必须将 .ini 文件添加到 /etc/php/5.6/mods-available。然后使用phpenmod 启用扩展。

      所以要安装并启用raphf-1.1.2,

      $ pecl install raphf-1.1.2
      $ echo "extension=raphf.so" >> /etc/php/5.6/mods-available
      $ phpenmod raphf
      

      请注意,这些命令可能需要sudo

      同样,对于 propro-1.0.2

      $ pecl install raphf-1.0.2
      $ echo "extension=raphf.so" >> /etc/php/5.6/mods-available
      $ phpenmod raphf
      

      如果您使用php -m 查看所有已加载的扩展程序,您应该会在列表中看到 raphf 和 propro。

      现在你可以安装 pecl_http-2.6.0 了

      $ pecl install pecl_http-2.6.0
      

      安装应该成功完成。

      $ pecl list
      Installed packages, channel pecl.php.net:
      =========================================
      Package   Version State
      pecl_http 2.6.0   stable
      propro    1.0.2   stable
      raphf     1.1.2   stable
      

      如果您像我一样使用pecl,您可能会看到如下警告:

      install ok: channel://pecl.php.net/pecl_http-2.6.0
      configuration option "php_ini" is not set to php.ini location
      You should add "extension=http.so" to php.ini
      

      这是因为我的pearpeclphp_ini 配置未设置。

      【讨论】:

        猜你喜欢
        • 2015-06-24
        • 2015-10-03
        • 1970-01-01
        • 2011-08-31
        • 1970-01-01
        • 2014-10-25
        • 2016-02-01
        • 2015-03-27
        相关资源
        最近更新 更多