[英]Ubuntu pecl install pecl_http fail
我正在嘗試安裝此擴展,但在配置階段失敗。 我在ubuntu 12.04上,我剛剛安裝了這些軟件包:
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.so
, propro.so
和http.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。
運行命令
sudo yum安裝php-raphf
sudo pecl install pecl_http
等/ phph5 / apache2的/ conf.d
添加兩個文件
添加內容
延長= 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
這是因為我的pear
和pecl
的php_ini
配置沒有設置。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.