php Ubuntu pecl 安装 pecl_http 失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25892808/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ubuntu pecl install pecl_http fail
提问by Gare88
I'm trying to install this extension but it fails in the configuration phase. I'm on ubuntu 12.04 and I have just installed these packages:
我正在尝试安装此扩展,但在配置阶段失败。我在 ubuntu 12.04 上,我刚刚安装了这些软件包:
- libcurl3-openssl-dev
- php-http
- libpcre3-dev
- libcurl3
- php-pear
- php5-dev
- libcurl3-openssl-dev
- php-http
- libpcre3-dev
- libcurl3
- php-梨
- php5-dev
PHP version:
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
Here is the log of the installation command:
下面是安装命令的日志:
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
It seems that is a problem with pecl/raphfso I tried:
这似乎是pecl/raphf的问题,所以我试过:
sudo pecl install raphf
pecl/raphf is already installed and is the same as the released version 1.0.4
install failed
At the end of php.ini file located on /etc/php5/apache2/php.ini I added the line:
在位于 /etc/php5/apache2/php.ini 的 php.ini 文件的末尾,我添加了以下行:
extension=raphf.so
extension=propro.so
extension=http.so
Is there anything else I can try?
还有什么我可以尝试的吗?
采纳答案by mschuett
You need to install php-raphf from your package manager.
您需要从包管理器安装 php-raphf。
for me i installed the module using the following. In your case you should be able to switch out yum for apt-get.
对我来说,我使用以下方法安装了模块。在您的情况下,您应该能够为 apt-get 切换 yum。
sudo yum install php-raphf
sudo yum install php-propro
sudo pecl install pecl_http
The you will need to add extension = http.so to your php.ini file. But it looks like you have already done that.
您需要将 extension = http.so 添加到 php.ini 文件中。但看起来你已经这样做了。
pecl does not actually install the .so file that you are looking for.
pecl 实际上并没有安装您正在寻找的 .so 文件。
回答by coviex
if you have ubuntu 13 or 14, try pecl install pecl_http-1.7.6
as newer versions still do not load for some reason.
如果您有 ubuntu 13 或 14,请尝试,pecl install pecl_http-1.7.6
因为由于某种原因,较新的版本仍然无法加载。
回答by Krizhanovskiy Vlad
On Ubuntu 12.04.5 LTS this worked for me:
在 Ubuntu 12.04.5 LTS 上,这对我有用:
First install some prerequisites needed for compilation:
首先安装一些编译所需的先决条件:
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
after that go to the folder /usr/lib/php5/modules
and check if the libraries are there: raphf.so
, propro.so
and http.so
.
之后转到该文件夹/usr/lib/php5/modules
并检查库是否在那里:raphf.so
,propro.so
和http.so
.
If your php.ini
(at /etc/php5/apache2/php.ini
and /etc/php5/cli/php.ini
) does not contain these extensions, add them:
如果您的php.ini
(at/etc/php5/apache2/php.ini
和/etc/php5/cli/php.ini
) 不包含这些扩展名,请添加它们:
extension=http.so
extension=propro.so
extension=raphf.so
or using the absolute path to the files, e.g. extension=/usr/lib/php5/modules/http.so
.
或使用文件的绝对路径,例如extension=/usr/lib/php5/modules/http.so
.
And as last step restart your webserver, thus loading the new configuration:
最后一步重新启动您的网络服务器,从而加载新配置:
sudo service apache2 reload
回答by Kruunch Arz
Just to add to @mschuett's answer, I found that when I got the same error as the OP that changing my extension reference in the php.ini did the trick.
只是为了添加@mschuett 的回答,我发现当我遇到与 OP 相同的错误时,在 php.ini 中更改我的扩展引用就成功了。
extension=raphf.so
to
到
extension=/usr/lib/php5/20121212/raphf.so
then
然后
sudo pecl install pecl_http
Also setting the following will keep you from having to hand edit your php.ini file when a pecl installation wants to modify it:
还设置以下内容将使您不必在 pecl 安装想要修改它时手动编辑您的 php.ini 文件:
pear config-set php_ini /etc/php5/apache2/php.ini
pecl config-set php_ini /etc/php5/apache2/php.ini
NOTE: This worked for Ubuntu 14.04 LTS.
注意:这适用于 Ubuntu 14.04 LTS。
回答by Rahul Yadav
run command
运行命令
sudo yum install php-raphf
- sudo yum install php-propro
sudo pecl install pecl_http
etc/phph5/apache2/conf.d
须藤 yum 安装 php-raphf
- 须藤 yum 安装 php-prop
须藤 pecl 安装 pecl_http
etc/phph5/apache2/conf.d
add two file
添加两个文件
- raphf.ini
- 配置文件
add content
添加内容
extension=raphf.so
扩展名=raphf.so
solr.ini
配置文件
add content
添加内容
extension=raphf.so
扩展名=raphf.so
add in php.ini file
在 php.ini 文件中添加
extension=http.so extension=propro.so extension=raphf.so or extension=/usr/lib/php5/20121212/raphf.so extension=solr.so
extension=http.so extension=propro.so extension=raphf.so 或 extension=/usr/lib/php5/20121212/raphf.so extension=solr.so
回答by ivan.sim
I bump into this issue while trying to install pecl_http-2.6.0, raphf-1.1.2 and propro-1.0.2 on Ubuntu 16.04 and php-fpm5.6. I can't use apt
to install raphf and propro (as @mschuett suggested) because apt
can only install raphf 2.0.0 and propro 2.1.0 which works only for PHP 7.
我在尝试在 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。
I resolve the problem with the following steps without needing to update the php.ini nor using apt
.
我通过以下步骤解决了问题,无需更新 php.ini 或使用apt
.
First of all, to get php-fpm to load a new extension, an .ini file must be added to /etc/php/5.6/mods-available
. Then use phpenmod
to enable the extension.
首先,要让 php-fpm 加载一个新的扩展,必须在 .ini 文件中添加一个 .ini 文件/etc/php/5.6/mods-available
。然后使用phpenmod
启用扩展。
So to install and enable raphf-1.1.2,
所以要安装和启用 raphf-1.1.2,
$ pecl install raphf-1.1.2
$ echo "extension=raphf.so" >> /etc/php/5.6/mods-available
$ phpenmod raphf
Note that you might need sudo
for these commands.
请注意,您可能需要sudo
这些命令。
Similarly, for propro-1.0.2
同样,对于 propro-1.0.2
$ pecl install raphf-1.0.2
$ echo "extension=raphf.so" >> /etc/php/5.6/mods-available
$ phpenmod raphf
If you use php -m
to view all the loaded extensions, you should see raphf and propro in the list.
如果您使用php -m
查看所有加载的扩展,您应该在列表中看到 raphf 和 propro。
Now you can install pecl_http-2.6.0 with
现在你可以安装 pecl_http-2.6.0
$ pecl install pecl_http-2.6.0
The installation should complete successfully.
安装应该成功完成。
$ 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
If you are using pecl
like me, you might see warning such as:
如果您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
which happens because the php_ini
config of my pear
and pecl
aren't set.
发生这种情况是因为php_ini
mypear
和的配置pecl
未设置。