繁体   English   中英

Ubuntu pecl安装pecl_http失败

[英]Ubuntu pecl install pecl_http fail

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

  • libcurl3-的OpenSSL开发
  • 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-raphf。

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

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

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

pecl实际上并没有安装你正在寻找的.so文件。

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

在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

只是为了添加@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。

运行命令

  1. sudo yum安装php-raphf

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

  3. 等/ phph5 / apache2的/ conf.d

添加两个文件

  • raphf.ini

添加内容

延长= raphf.so

solr.ini

添加内容

延长= raphf.so

添加php.ini文件

extension = http.so extension = propro.so extension = raphf.so或extension = / usr / lib / php5 / 20121212 / raphf.so extension = solr.so

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

我使用以下步骤解决问题,而无需更新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配置没有设置。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM