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

时间:2016-02-22 22:54:07

标签: php pecl

我正在尝试在Ubuntu 14.04上安装pecl_http,但它报告要求使用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
$

同样在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

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

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

2 个答案:

答案 0 :(得分:18)

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

  

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

     

要检索包版本1.1,请使用“Package-1.1”进行检索   包状态测试版,使用“Package-beta”。检索未压缩的   file,append .tar(确保首先没有相同名称的文件)

according to the changelogpecl_http 3.0是第一个与PHP 7兼容的版本,所以也许可以尝试上一个版本。

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

答案 1 :(得分:2)

这个问题有一个公认的答案,但我会在这个问题上加上我的2美分:

基于您的PHP版本:

  • for PHP 7使用' pecl install oci8'
  • for PHP 5.2 to 5.6使用' pecl install oci8-2.0.12'
  • for PHP 4.3.9 to 5.1使用' pecl install oci8-1.4.10'

OCI8 2.0.12 PHP 5.6.x的最终版本

OCI8 2.1.x 仅适用于 PHP 7

安装适用于PHP 5.6.31的OCI8

[root@server bin]# ./pecl install oci8-2.0.12
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading oci8-2.0.12.tar ...
Starting to download oci8-2.0.12.tar (1,615,360 bytes)
....
11 source files, building
running: phpize
Configuring for:
...

PHP 5.6.31 and OCI8 2.0.12的预期输出

这是安装OCI8支持的最简单方法。