Ubuntu pecl安装pecl_http失败

Gar*_*e88 16 php ubuntu pecl

我正在尝试安装此扩展,但在配置阶段失败.我在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
Run Code Online (Sandbox Code Playgroud)

以下是安装命令的日志:

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
Run Code Online (Sandbox Code Playgroud)

这似乎是pecl/raphf的一个问题所以我试过:

sudo pecl install raphf
pecl/raphf is already installed and is the same as the released version 1.0.4
install failed
Run Code Online (Sandbox Code Playgroud)

在位于/etc/php5/apache2/php.ini上的php.ini文件的末尾,我添加了以下行:

extension=raphf.so
extension=propro.so
extension=http.so
Run Code Online (Sandbox Code Playgroud)

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

msc*_*ett 10

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

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

sudo yum install php-raphf
sudo yum install php-propro
sudo pecl install pecl_http
Run Code Online (Sandbox Code Playgroud)

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

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


cov*_*iex 8

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


小智 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
Run Code Online (Sandbox Code Playgroud)

之后去到该文件夹/usr/lib/php5/modules,并检查库有:raphf.so,propro.sohttp.so.

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

extension=http.so
extension=propro.so
extension=raphf.so
Run Code Online (Sandbox Code Playgroud)

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

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

sudo service apache2 reload
Run Code Online (Sandbox Code Playgroud)


小智 5

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

extension=raphf.so
Run Code Online (Sandbox Code Playgroud)

extension=/usr/lib/php5/20121212/raphf.so
Run Code Online (Sandbox Code Playgroud)

然后

sudo pecl install pecl_http
Run Code Online (Sandbox Code Playgroud)

设置以下内容将使您不必在pecl安装想要修改它时手动编辑php.ini文件:

pear config-set php_ini /etc/php5/apache2/php.ini
pecl config-set php_ini /etc/php5/apache2/php.ini
Run Code Online (Sandbox Code Playgroud)

注意:这适用于Ubuntu 14.04 LTS.