如何在PHP 5.x上安装http_pecl?

tec*_*raf 9 php pecl

我试图pecl_http在Ubuntu 14.04 上安装,但它报告要求PHP 7.

$ sudo pecl install pecl_http
pecl/pecl_http requires PHP (version >= 7.0.0), installed version is 5.5.9-1ubuntu4.14
pecl/raphf requires PHP (version >= 7.0.0), installed version is 5.5.9-1ubuntu4.14
pecl/propro requires PHP (version >= 7.0.0), installed version is 5.5.9-1ubuntu4.14
No valid packages found
install failed
$
Run Code Online (Sandbox Code Playgroud)

同样在Debian上:

pecl/pecl_http requires PHP (version >= 7.0.0), installed version is 5.6.17-0+deb8u1
pecl/raphf requires PHP (version >= 7.0.0), installed version is 5.6.17-0+deb8u1
pecl/propro requires PHP (version >= 7.0.0), installed version is 5.6.17-0+deb8u1
Run Code Online (Sandbox Code Playgroud)

我无法找到的changelog的任何信息pecl_http不与PHP 5.x的向后兼容

我尝试使用PHP 7.0并且安装成功,但是我可以用PHP 5.x安装它吗?

mik*_*n32 18

您需要找出pecl_http不需要当前版本的PHP的版本,然后专门安装该版本.根据文件:

"Package [-version/state] [.tar]":查询默认频道的服务器(pear.php.net)并下载具有首选质量/状态(稳定)的最新软件包.

要检索包版本1.1,请使用"Package-1.1"检索包状态beta,使用"Package-beta".要检索未压缩的文件,请附加.tar(确保首先没有相同名称的文件)

根据更新日志,pecl_http3.0是第一个PHP 7兼容的版本,所以也许尝试前面.

最后的答案:你一直在寻找 sudo pecl install pecl_http-2.5.5