2011-12-03 46 views
4

我试图安装pecl HTTPRequest扩展。但是,当我在CentOS服务器上运行以下命令时,我收到没有发行版可用且安装失败的消息。pecl安装pecl_http没有发布可用

$pecl install pecl_http 
No releases available for package "pecl.php.net/pecl_http" 
install failed 

我在做什么错?

编辑:PECL配置

Configuration (channel pecl.php.net): 
===================================== 
Auto-discover new Channels  auto_discover <not set> 
Default Channel    default_channel pecl.php.net 
HTTP Proxy Server Address  http_proxy  <not set> 
PEAR server [DEPRECATED]  master_server pear.php.net 
Default Channel Mirror   preferred_mirror pecl.php.net 
Remote Configuration File  remote_config <not set> 
PEAR executables directory  bin_dir   /usr/local/bin 
PEAR documentation directory doc_dir   /usr/local/lib/php/doc 
PHP extension directory  ext_dir   ./ 
PEAR directory     php_dir   /usr/local/lib/php 
PEAR Installer cache directory cache_dir  /tmp/pear/cache 
PEAR configuration file  cfg_dir   /usr/local/lib/php/cfg 
directory 
PEAR data directory   data_dir   /usr/local/lib/php/data 
PEAR Installer download  download_dir  /tmp/pear/download 
directory 
PHP CLI/CGI binary    php_bin   /usr/local/bin/php 
php.ini location    php_ini   <not set> 
--program-prefix passed to  php_prefix  <not set> 
PHP's ./configure 
--program-suffix passed to  php_suffix  <not set> 
PHP's ./configure 
PEAR Installer temp directory temp_dir   /tmp/pear/temp 
PEAR test directory   test_dir   /usr/local/lib/php/test 
PEAR www files directory  www_dir   /usr/local/lib/php/htdocs 
Cache TimeToLive    cache_ttl  3600 
Preferred Package State  preferred_state stable 
Unix file mask     umask   22 
Debug Log Level    verbose   1 
PEAR password (for    password   <not set> 
maintainers) 
Signature Handling Program  sig_bin   /usr/bin/gpg 
Signature Key Directory  sig_keydir  /usr/local/etc/pearkeys 
Signature Key Id    sig_keyid  <not set> 
Package Signature Type   sig_type   gpg 
PEAR username (for    username   <not set> 
maintainers) 
User Configuration File  Filename   /home/onsboek/.pearrc 
System Configuration File  Filename   /usr/local/etc/pear.conf 
+0

显示你的'pecl config-show'输出。可能需要修改'preferred_state'这个东西。 – mario

+0

添加pecl配置 – Thomas

+0

看不出有什么奇怪的。但为什么你不使用发行版提供的PHP安装? (作为最后的手段,你可以自己下载,并使用'pecl package。/'或者手动构建它。) – mario

回答

0

请尝试以下;

yum install php-pear 
yum install gcc 
yum install curl-devel 
/usr/bin/pecl install pecl_http 

添加以下行为/etc/php.ini文件: 延长= http.so

重新启动Apache服务器,从而扩展可加载:

httpd -k restart 

如果不起作用,让我知道输出。

1

在我的情况下,出现了一个问题: 当标题“Accept-Encoding:”为空时,pecl.php.net没有回答。

在pear源代码中为该行添加一个空格,解决了一个问题。

文件:/usr/local/lib/php/PEAR/REST.php

行〜405

$request .= "AcceptEncoding:\r\n";   //<---original line 
$request .= "AcceptEncoding: \r\n";   //<--changed to this (added space) 

...或者简单的脚本可以进行变化:

#!/usr/bin/env bash 
target=`pecl config-get php_dir`/PEAR/REST.php 
     [ -f "$target" ] || { echo file $target not found; exit; } 
sed -i 's/Accept-Encoding:\\r\\n/AcceptEncoding: \\r\\n/g' $target 
+1

这解决了我的问题,但我不明白原因,因为我有另一台服务器工作正常,没有增加空间接受编码。 –

+0

奇怪的是,你是第一次确认这一点,我在所有3种不同的服务器配置中有这个错误... –