skip to Main Content

I try to install mongodb to Centos 7 server with PHP. I follow the install guide from https://www.php.net/manual/en/mongodb.installation.pecl.php

But sudo pecl install mongodb show error message:

WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading mongodb-1.8.1.tgz ...
Starting to download mongodb-1.8.1.tgz (1,292,453 bytes)
................................................................................................................................................................................................................................................................done: 1,292,453 bytes
586 source files, building
running: phpize
Can't find PHP headers in /usr/include/php
The php-devel package is required for use of this command.
ERROR: `phpize' failed

As the error message recommded, I install php-devel package by

yum install php-devel

But I got a lot of Dependency error:

Error: Package: libstdc++-devel-4.8.5-16.el7_4.2.x86_64 (ultra-centos-7.4-updates)
           Requires: libstdc++(x86-64) = 4.8.5-16.el7_4.2
           Installed: libstdc++-4.8.5-28.el7_5.1.x86_64 (installed)
               libstdc++(x86-64) = 4.8.5-28.el7_5.1
           Available: libstdc++-4.8.5-16.el7.x86_64 (ultra-centos-7.4-base)
               libstdc++(x86-64) = 4.8.5-16.el7
           Available: libstdc++-4.8.5-16.el7_4.1.x86_64 (ultra-centos-7.4-updates)
               libstdc++(x86-64) = 4.8.5-16.el7_4.1
           Available: libstdc++-4.8.5-16.el7_4.2.x86_64 (ultra-centos-7.4-updates)
               libstdc++(x86-64) = 4.8.5-16.el7_4.2
Error: Package: libcom_err-devel-1.42.9-10.el7.x86_64 (ultra-centos-7.4-base)
           Requires: libcom_err(x86-64) = 1.42.9-10.el7
           Installed: libcom_err-1.42.9-12.el7_5.x86_64 (installed)
               libcom_err(x86-64) = 1.42.9-12.el7_5
           Available: libcom_err-1.42.9-10.el7.x86_64 (ultra-centos-7.4-base)
               libcom_err(x86-64) = 1.42.9-10.el7
Error: Package: gcc-c++-4.8.5-16.el7_4.2.x86_64 (ultra-centos-7.4-updates)
           Requires: libstdc++ = 4.8.5-16.el7_4.2
           Installed: libstdc++-4.8.5-28.el7_5.1.x86_64 (installed)
               libstdc++ = 4.8.2-16.el7_5
               libstdc++ = 4.8.5-28.el7_5.1
           Available: libstdc++-4.8.5-16.el7.x86_64 (ultra-centos-7.4-base)
               libstdc++ = 4.8.5-16.el7
               libstdc++ = 4.8.2-16.el7
           Available: libstdc++-4.8.5-16.el7_4.1.x86_64 (ultra-centos-7.4-updates)
               libstdc++ = 4.8.5-16.el7_4.1
               libstdc++ = 4.8.2-16.el7_4
           Available: libstdc++-4.8.5-16.el7_4.2.x86_64 (ultra-centos-7.4-updates)
               libstdc++ = 4.8.5-16.el7_4.2
               libstdc++ = 4.8.2-16.el7_4
Error: Package: glibc-devel-2.17-196.el7_4.2.x86_64 (ultra-centos-7.4-updates)
           Requires: glibc = 2.17-196.el7_4.2
           Installed: glibc-2.17-222.el7.x86_64 (installed)
               glibc = 2.17-222.el7
           Available: glibc-2.17-196.el7.x86_64 (ultra-centos-7.4-base)
               glibc = 2.17-196.el7
           Available: glibc-2.17-196.el7_4.2.x86_64 (ultra-centos-7.4-updates)
               glibc = 2.17-196.el7_4.2
Error: Package: glibc-headers-2.17-196.el7_4.2.x86_64 (ultra-centos-7.4-updates)
           Requires: glibc = 2.17-196.el7_4.2
           Installed: glibc-2.17-222.el7.x86_64 (installed)
               glibc = 2.17-222.el7
           Available: glibc-2.17-196.el7.x86_64 (ultra-centos-7.4-base)
               glibc = 2.17-196.el7
           Available: glibc-2.17-196.el7_4.2.x86_64 (ultra-centos-7.4-updates)
               glibc = 2.17-196.el7_4.2
Error: Package: gcc-4.8.5-16.el7_4.2.x86_64 (ultra-centos-7.4-updates)
           Requires: libgomp = 4.8.5-16.el7_4.2
           Installed: libgomp-4.8.5-28.el7_5.1.x86_64 (installed)
               libgomp = 4.8.2-16.el7_5
               libgomp = 4.8.5-28.el7_5.1
           Available: libgomp-4.8.5-16.el7.x86_64 (ultra-centos-7.4-base)
               libgomp = 4.8.5-16.el7
               libgomp = 4.8.2-16.el7
           Available: libgomp-4.8.5-16.el7_4.1.x86_64 (ultra-centos-7.4-updates)
               libgomp = 4.8.5-16.el7_4.1
               libgomp = 4.8.2-16.el7_4
           Available: libgomp-4.8.5-16.el7_4.2.x86_64 (ultra-centos-7.4-updates)
               libgomp = 4.8.5-16.el7_4.2
               libgomp = 4.8.2-16.el7_4
Error: Package: 1:openssl-devel-1.0.2k-8.el7.x86_64 (ultra-centos-7.4-base)
           Requires: openssl-libs(x86-64) = 1:1.0.2k-8.el7
           Installed: 1:openssl-libs-1.0.2k-12.el7.x86_64 (installed)
               openssl-libs(x86-64) = 1:1.0.2k-12.el7
           Available: 1:openssl-libs-1.0.2k-8.el7.x86_64 (ultra-centos-7.4-base)
               openssl-libs(x86-64) = 1:1.0.2k-8.el7
Error: Package: libkadm5-1.15.1-8.el7.x86_64 (ultra-centos-7.4-base)
           Requires: krb5-libs(x86-64) = 1.15.1-8.el7
           Installed: krb5-libs-1.15.1-19.el7.x86_64 (installed)
               krb5-libs(x86-64) = 1.15.1-19.el7
           Available: krb5-libs-1.15.1-8.el7.x86_64 (ultra-centos-7.4-base)
               krb5-libs(x86-64) = 1.15.1-8.el7
Error: Package: krb5-devel-1.15.1-8.el7.x86_64 (ultra-centos-7.4-base)
           Requires: krb5-libs(x86-64) = 1.15.1-8.el7
           Installed: krb5-libs-1.15.1-19.el7.x86_64 (installed)
               krb5-libs(x86-64) = 1.15.1-19.el7
           Available: krb5-libs-1.15.1-8.el7.x86_64 (ultra-centos-7.4-base)
               krb5-libs(x86-64) = 1.15.1-8.el7
Error: Package: libsepol-devel-2.5-6.el7.x86_64 (ultra-centos-7.4-base)
           Requires: libsepol(x86-64) = 2.5-6.el7
           Installed: libsepol-2.5-8.1.el7.x86_64 (installed)
               libsepol(x86-64) = 2.5-8.1.el7
           Available: libsepol-2.5-6.el7.x86_64 (ultra-centos-7.4-base)
               libsepol(x86-64) = 2.5-6.el7
Error: Package: libselinux-devel-2.5-11.el7.x86_64 (ultra-centos-7.4-base)
           Requires: libselinux(x86-64) = 2.5-11.el7
           Installed: libselinux-2.5-12.el7.x86_64 (installed)
               libselinux(x86-64) = 2.5-12.el7
           Available: libselinux-2.5-11.el7.x86_64 (ultra-centos-7.4-base)
               libselinux(x86-64) = 2.5-11.el7
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Below are the server details, any solution?

yum repolist

Loaded plugins: changelog, fastestmirror, versionlock
Loading mirror speeds from cached hostfile
 * epel: download.nus.edu.sg
 * remi-php73: mirrors.thzhost.com
 * remi-safe: mirrors.thzhost.com
repo id                                                                    repo name                                                                                               status
MongoDB/7/x86_64                                                           MongoDB Repository                                                                                          62
*epel/x86_64                                                               Extra Packages for Enterprise Linux 7 - x86_64                                                          13,463
ius/x86_64                                                                 IUS for Enterprise Linux 7 - x86_64                                                                        486
mongodb-org-3.4/7                                                          MongoDB Repository                                                                                         125
nodesource/x86_64                                                          Node.js Packages for Enterprise Linux 7 - x86_64                                                           106
remi-php73                                                                 Remi's PHP 7.3 RPM repository for Enterprise Linux 7 - x86_64                                              384
remi-safe                                                                  Safe Remi's RPM repository for Enterprise Linux 7 - x86_64                                               4,006
ultra-centos-7.4-base                                                      UltraServe CentOS-7.4 - Base                                                                             7,407
ultra-centos-7.4-extras                                                    UltraServe CentOS-7.4 - Extras                                                                             401
ultra-centos-7.4-updates                                                   UltraServe CentOS-7.4 - Updates                                                                          1,836
ultra-centos-7.x-newrelic-monitoring                                       UltraServe CentOS-7.x - New Relic Infrastructure Monitoring Agent                                           10
ultra-centos-7.x-ultrarepo                                                 UltraServe CentOS-7.x - UltraServe Repo Packages                                                            50
repolist: 28,336

rpm -q centos-release

centos-release-7-5.1804.el7.centos.2.x86_64

php –version

PHP 7.3.23 (cli) (built: Sep 29 2020 08:33:03) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.23, Copyright (c) 1998-2018 Zend Technologies

2

Answers


  1. Chosen as BEST ANSWER

    Seem the ultra-centos-7.4-base come with AWS EC2 server.

    To people who face the same dependency issue, you may consider change the repos source by:

    wget -O /etc/yum.repos.d/CentOS-Base.repo http://wiki.docking.org/index.php/CentOS_7_Base.repo
    sed -i  's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo
    

    Double check you repo:

    yum repolist 
    

    Then you should able to run yum install php-devel


  2. remi-php73 Remi’s PHP 7.3 RPM repository for Enterprise Linux 7 – x86_64 384

    Looks like you are using my repository which provides most extensions

    So, instead of trying to build it from sources, I recommend to simply use the available RPMs

    yum install php-pecl-mongodb
    

    Or if you use the Software Collections

    yum install php73-pecl-mongodb
    

    As explained by the Wizard

    BTW, the installation issue seems related to ultra-centos-7.4-base (don’t even know what is this) as you have installed packages from 7.5

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search