struggling to install PHP pecl on Centos
Asked Answered
M

10

20

I'm trying to install the php_http PHP extension on my CentOS server.

I have done:

yum install php-pear

But get:

No package php-pear available

Yet I can do:

pear

And get a list of commands from Pear.

Same for yum install pecl. I can do pecl but pecl install pecl_http returns:

No releases available for package "pecl.php.net/pecl_http"
install failed

Yet /usr/bin/pecl isn't a directory that exists. Also a sudo pecl install pecl_http returns sudo: pecl: command not found, which I find quite odd.

I'm not entirely sure what's going on here/what I'm doing wrong.

edit: I am using the following repos:

base                         CentOS-6 - Base
epel                         Extra Packages for Enterprise Linux 6 - x86_64
extras                       CentOS-6 - Extras
rpmforge                     RHEL 6 - RPMforge.net - dag
updates                      CentOS-6 - Updates
vz-base                      vz-base
vz-updates                   vz-updates                                                            
Mantel answered 22/10, 2013 at 11:52 Comment(5)
What repositories are you using?Jd
@BenCarey I have edited my question to include some output of yum repolist.Mantel
This really is a serverfault.com question. I can't see a programming question here at all, no offence.Ascomycete
@Ascomycete Feel free to flag it for migration, then.Mantel
On CentOS 7 I used: sudo yum --enablerepo=remi,remi-php72 install php-pear php-develConstrict
C
16

On CentOS,

  1. Install PHP Pear if not installed yet:

    # yum install php-pear
    
  2. Install GCC if not installed yet:

    # yum install gcc
    
  3. Install cURL if not installed yet:

    # yum install curl-devel
    
  4. Install following libraries if not installed yet:

    # yum install php-devel
    # yum install zlib-devel
    # yum install pcre-devel
    
  5. Start the main installation:

    # pecl install pecl_http
    
  6. Add the following line to /etc/php.ini file

    extension=raphf.so
    extension=propro.so
    extension=http.so
    
  7. Restart apache server so the extension can be loaded

    # service httpd restart
    

You can check if it installed successfully or not:

# pecl list
Capitate answered 22/7, 2015 at 9:0 Comment(1)
If the newest version 2.x of pecl not work, uninstall it by pecl uninstall pecl_http, then install older version by pecl install pecl_http-1.7.6, it works properlly.Capitate
P
10

Step 1) import the REMI repo

CentOS 5

rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm;
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm;

CentOS 6

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm;
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm;

Step 2) install php-pear

yum --enablerepo=remi,remi-php55 install php-pear

Step 3) install pecl_http

pecl install pecl_http
Paulettepauley answered 22/10, 2013 at 12:17 Comment(3)
I added the REMI repo and tried to install php-pear but it still can't find the package. I should add, I'm using PHP 5.4.19Mantel
on step 2, it says 'No package php-pear available.' any suggestions please ?Danford
@Danford try yum --enablerepo=remi,remi-php55 install php5-pearPaulettepauley
M
6

For other people having this problem. I discovered this question while trying to figure out why I was having the same problem. Turned out the default configuration at my hosting provider was to include php* in the exclude directive for yum. Check /etc/yum.conf and make sure that the package you're trying to install isn't matched by an entry in the exclude directive.

Measured answered 7/6, 2014 at 19:29 Comment(1)
I was migrating a site on bluehost and this seemed to be the situation too. The service is normally all managed with whm / cpanel so there must be something to do with this.Jopa
E
6

if you are running php 7 you might want to try this

yum install php70w-pear

if you get any errors, be sure to uninstall the pear package from any previous attempts

yum remove php-pear

best of luck

Entertain answered 11/12, 2015 at 4:59 Comment(0)
I
1

If you are using php 5.4.x, IMO best repo to use is iuscommunity. Its very stable and used by Rackspace to do only PHP and a few other packages for CentOS.

rpm -Uhv http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-11.ius.centos6.noarch.rpm

yum install php54-pear

Mind you, the reason why its php54-pear and not php-pear is because 5.3 and 5.4 both are compiled in the repository. Here is the list of php packages -> http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/repoview/development.languages.group.html

I tested this and it works, but I only use EPEL and iuscommunity REPO's. I avoid using rpmforge myself.

Infernal answered 18/11, 2013 at 13:12 Comment(3)
I just tried that and I still get no package php54-pear available.Mantel
Then you did something wrong. Because the package is in the repo. You can always do this rpm -Uhv dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/…Infernal
Same result. To be honest I'm not bothered anymore. So yeah.Mantel
E
0

Centos 6.5 and php7:

sudo su -

yum install yum-utils

you can get last version of lua : http://pecl.php.net/package/lua

wget http://pecl.php.net/get/lua-2.0.4.tgz

tar -xvzf  lua-2.0.4.tgz

cd lua-2.0.4

mkdir  /usr/include/lua

mv * /usr/include/lua

yum install gcc

yum install php70w-pearl php70w-devel



yum install curl-devel

yum install zlib-devel

yum install pcre-devel

ln -s /usr/include/lua.h /usr/include/lua/lua.h

rpm -Uvh https://centos6.iuscommunity.org/ius-release.rpm

yum-config-manager --enable remi-php70

yum update 

yum --enablerepo=remi,remi-php70 install php70w-pear

yum install lua-devel lua-static

pecl install lua-2.0.4
Erine answered 17/10, 2017 at 6:17 Comment(0)
S
0

Whatever your PHP provider is (IUS, Remi or Webtatic), the pear package and the pecl extensions "should" be available there, without any need to compile it from sources (which is usually discouraged, especially on production)

At least "remi" provides most extensions, see the list

So installation should be as simple as

yum install php-pecl-http
yum install php-pecl-lua
etc

And, don't forget to read the Wizard instructions

Scrouge answered 17/10, 2017 at 14:27 Comment(0)
X
0

I tried almost everything on this list before I finally realized that my WHM/cPanel installation was blocking the yum packages. I have to install all PECL modules (I was stuck trying to install mongodb on this particular occation) through the Home > Software > Module Installers inside WHM (cpanel documentation says that you have to be logged in as root).

Xebec answered 4/8, 2021 at 22:57 Comment(0)
K
0

I tried all of these I still can't get pecl installed. I am running CentOS

"No package php-pecl-mongo available."

These are the types of errors I get

Katti answered 21/11, 2023 at 19:25 Comment(2)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Edyth
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewWarthman
H
-1

After watching a lot of threads and installing pear and all the devtool, I finally solved it installing this extension:

yum install php-pecl-mongo

as I seen in - https://madcoda.com/2012/12/install-mongodb-php-driver-in-centos-6-3/

Halves answered 27/1, 2017 at 10:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.