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

9

我正在尝试在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

我找不到任何关于pecl_http与PHP 5.x不兼容的信息,您可以在changelog中查看。我已经尝试了PHP 7.0并成功安装,但是否有办法在PHP 5.x上安装?
2个回答

18
您需要找到不需要当前版本PHP的pecl_http版本,然后专门安装该版本。 根据文档:

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

要检索软件包版本1.1,请使用“Package-1.1”,要检索软件包状态beta,请使用“Package-beta”。要检索未压缩的文件,请添加.tar(确保没有同名文件)。

根据更改日志pecl_http 3.0是第一个与PHP 7兼容的版本,因此可以尝试先前的版本。
最终答案:您需要寻找sudo pecl install pecl_http-2.5.5

4
这个问题已经有了一个被接受的答案,但我会在这个主题上补充我的意见:
根据你的PHP版本:
  • 对于PHP 7,请使用“pecl install oci8”
  • 对于PHP 5.2到5.6,请使用“pecl install oci8-2.0.12”
  • 对于PHP 4.3.9到5.1,请使用“pecl install oci8-1.4.10”
OCI82.0.12是适用于PHP 5.6.x的最终版本。
OCI8 2.1.x仅适用于PHP 7安装OCI8 for PHP 5.6.31:
[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 和 OCI8 2.0.12

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


1
OP是需要pecl_http而不是oci8,还是我理解有误? - logicbloke

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接