Ubuntu pecl install pecl_http fail
Asked Answered
N

6

18

I'm trying to install this extension but it fails in the configuration phase. I'm on ubuntu 12.04 and I have just installed these packages:

  • libcurl3-openssl-dev
  • php-http
  • libpcre3-dev
  • libcurl3
  • php-pear
  • php5-dev

PHP version:

PHP 5.3.10-1ubuntu3.14 with Suhosin-Patch (cli) (built: Sep  4 2014 07:08:49) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

Here is the log of the installation command:

sudo pecl install pecl_http
downloading pecl_http-2.1.1.tgz ...
Starting to download pecl_http-2.1.1.tgz (158,441 bytes)
.................................done: 158,441 bytes
64 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
Enable extended HTTP support [yes] : 
where to find zlib [/usr] : 
where to find libcurl [/usr] : 
where to find libevent [/usr] : 
building in /tmp/pear/temp/pear-build-rootqE2kgU/pecl_http-2.1.1
running: /tmp/pear/temp/pecl_http/configure --with-http --with-http-zlib-dir=/usr --with-http-libcurl-dir=/usr --with-http-libevent-dir=/home/gare88/Lib/Php/libevent-2.0.21-stable/
checking for grep that handles long lines and -e... /bin/grep

[... cut...]

checking for zlib.h... found in /usr
checking for zlib version >= 1.2.0.4... 1.2.3.4
checking for curl/curl.h... found in /usr
checking for curl-config... found: /usr/bin/curl-config
checking for curl version >= 7.18.2... 7.22.0
checking for SSL support in libcurl... yes
checking for openssl support in libcurl... no
checking for gnutls support in libcurl... no
checking for ares support in libcurl... no
checking for bundled SSL CA info... /etc/ssl/certs/ca-certificates.crt
checking for event2/event.h... not found
configure: WARNING: continuing without libevent support
checking for ext/raphf support... no
configure: error: Please install pecl/raphf and activate extension=raphf.so in your php.ini
ERROR: `/tmp/pear/temp/pecl_http/configure --with-http --with-http-zlib-dir=/usr --with-http-libcurl-dir=/usr --with-http-libevent-dir=/usr' failed

It seems that is a problem with pecl/raphf so I tried:

sudo pecl install raphf
pecl/raphf is already installed and is the same as the released version 1.0.4
install failed

At the end of php.ini file located on /etc/php5/apache2/php.ini I added the line:

extension=raphf.so
extension=propro.so
extension=http.so

Is there anything else I can try?

Novanovaculite answered 17/9, 2014 at 14:4 Comment(1)
There is a PHP bug related to this. Doesn't look like it's been fixed.Lollar
J
12

You need to install php-raphf from your package manager.

for me i installed the module using the following. In your case you should be able to switch out yum for apt-get.

sudo yum install php-raphf
sudo yum install php-propro
sudo pecl install pecl_http

The you will need to add extension = http.so to your php.ini file. But it looks like you have already done that.

pecl does not actually install the .so file that you are looking for.

Jutland answered 17/9, 2014 at 14:18 Comment(4)
Ok seems that the problem is the .so file missing (I tried find without result). I'm going to download it. ThanksNovanovaculite
Awesome, glad it looks like it worked for you let me know if you had to change anything for the install process so I can update the answer for others :)Jutland
ubuntu does not have either the raphf or propro extensions in the standard repos, at least in precise. I've installed them from pecl, .so files are in place and PHP shows them in php -m output, but pecl_http is still failing to install in the same way for me.Lollar
No package php-raphf available.Circumstantiality
N
8

if you have ubuntu 13 or 14, try pecl install pecl_http-1.7.6 as newer versions still do not load for some reason.

Nadianadine answered 21/10, 2014 at 15:24 Comment(2)
Are you sure it's not loaded or do you think it's not loaded because every(?) class/function provided by version 1 was removed in version 2.x. A documentation of version 2 can be found here: mdref.m6w6.name/httpLecroy
@Lecroy I was sure as it did not show up among loaded php extensions on several different linux distributionsNadianadine
S
7

On Ubuntu 12.04.5 LTS this worked for me:

First install some prerequisites needed for compilation:

sudo apt-get install php-http
sudo apt-get install php5-dev
sudo apt-get install libcurl3
sudo apt-get install libpcre3-dev
sudo apt-get install libcurl4-openssl-dev
sudo pecl install raphf 
sudo pecl install pecl_http-1.7.6

after that go to the folder /usr/lib/php5/modules and check if the libraries are there: raphf.so, propro.so and http.so.

If your php.ini (at /etc/php5/apache2/php.ini and /etc/php5/cli/php.ini) does not contain these extensions, add them:

extension=http.so
extension=propro.so
extension=raphf.so

or using the absolute path to the files, e.g. extension=/usr/lib/php5/modules/http.so.

And as last step restart your webserver, thus loading the new configuration:

sudo service apache2 reload
Selfpropulsion answered 4/1, 2015 at 14:56 Comment(3)
Documentation states that propro.so and raphf.so should be above http.so in the php.ini fileSomeday
The culprit was php-dev. Use sudo apt-get install php-dev` to be sure to install dev tools for the same php version that is called when you run php from command line.Dermoid
Tried this on Ubuntu 18.04. After trying all this I found I was getting an error on zlib and found I was missing the dev package. I installed it and then pecl_http completed successfully. apt-get install zlib1g-devMononuclear
L
5

Just to add to @mschuett's answer, I found that when I got the same error as the OP that changing my extension reference in the php.ini did the trick.

extension=raphf.so

to

extension=/usr/lib/php5/20121212/raphf.so

then

sudo pecl install pecl_http

Also setting the following will keep you from having to hand edit your php.ini file when a pecl installation wants to modify it:

pear config-set php_ini /etc/php5/apache2/php.ini
pecl config-set php_ini /etc/php5/apache2/php.ini

NOTE: This worked for Ubuntu 14.04 LTS.

Lustrate answered 22/10, 2014 at 14:31 Comment(0)
H
0

run command

  1. sudo yum install php-raphf

    • sudo yum install php-propro
  2. sudo pecl install pecl_http

  3. etc/phph5/apache2/conf.d

add two file

  • raphf.ini

add content

extension=raphf.so

solr.ini

add content

extension=raphf.so

add in php.ini file

extension=http.so extension=propro.so extension=raphf.so or extension=/usr/lib/php5/20121212/raphf.so extension=solr.so

Hipolitohipp answered 18/9, 2015 at 8:16 Comment(0)
C
0

I bump into this issue while trying to install pecl_http-2.6.0, raphf-1.1.2 and propro-1.0.2 on Ubuntu 16.04 and php-fpm5.6. I can't use apt to install raphf and propro (as @mschuett suggested) because apt can only install raphf 2.0.0 and propro 2.1.0 which works only for PHP 7.

I resolve the problem with the following steps without needing to update the php.ini nor using apt.

First of all, to get php-fpm to load a new extension, an .ini file must be added to /etc/php/5.6/mods-available. Then use phpenmod to enable the extension.

So to install and enable raphf-1.1.2,

$ pecl install raphf-1.1.2
$ echo "extension=raphf.so" >> /etc/php/5.6/mods-available
$ phpenmod raphf

Note that you might need sudo for these commands.

Similarly, for propro-1.0.2

$ pecl install raphf-1.0.2
$ echo "extension=raphf.so" >> /etc/php/5.6/mods-available
$ phpenmod raphf

If you use php -m to view all the loaded extensions, you should see raphf and propro in the list.

Now you can install pecl_http-2.6.0 with

$ pecl install pecl_http-2.6.0

The installation should complete successfully.

$ pecl list
Installed packages, channel pecl.php.net:
=========================================
Package   Version State
pecl_http 2.6.0   stable
propro    1.0.2   stable
raphf     1.1.2   stable

If you are using pecl like me, you might see warning such as:

install ok: channel://pecl.php.net/pecl_http-2.6.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=http.so" to php.ini

which happens because the php_ini config of my pear and pecl aren't set.

Conscription answered 23/5, 2018 at 22:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.