techraf techraf - 7 months ago 27
PHP Question

How to install http_pecl on PHP 5.x?

I am trying to install

pecl_http
on Ubuntu 14.04, however it reports to require 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
$


Similarly on 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


I can't find changelog any information that
pecl_http
is not backward compatible with PHP 5.x.

I tried with PHP 7.0 and it installed successfully, but is there anything I can do to install it with PHP 5.x?

Answer

You'll need to find out what version of pecl_http doesn't require the current version of PHP, and then specifically install that one. According to the documentation:

"Package[-version/state][.tar]" : queries your default channel's server (pear.php.net) and downloads the newest package with the preferred quality/state (stable).

To retrieve Package version 1.1, use "Package-1.1," to retrieve Package state beta, use "Package-beta." To retrieve an uncompressed file, append .tar (make sure there is no file by the same name first)

And according to the changelog, pecl_http 3.0 is the first PHP 7 compatible version, so maybe try the previous.

Final answer: you'd be looking for sudo pecl install pecl_http-2.5.5

Comments