Ubuntu pecl install pecl_http fail

前端 未结 6 1711
时光取名叫无心
时光取名叫无心 2020-12-17 10:16

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-
6条回答
  •  抹茶落季
    2020-12-17 10:52

    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.

提交回复
热议问题