centos7 yum 安装php7.4 mongoDB扩展


1、php7.4 mongoDB扩展 叫 mongo


2、执行 yum搜索

yum search mongo

注:如果有更改过PHP源,那么可能需要重新再安装源

yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm

3、搜索结果

[root@game-test xxx]# yum search mongo
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * remi-safe: cdn.centos.no
=========================================================== N/S matched: mongo ===========================================================
almas-mongolian-title-fonts.noarch : Mongolian Title font
collectd-write_mongodb.x86_64 : MongoDB output plugin for collectd
google-noto-sans-mongolian-fonts.noarch : Sans Mongolian font
holland-mongodump.noarch : Mongodump backup provider plugin for holland
libmongo-client.x86_64 : Alternative C driver for MongoDB
libmongo-client-devel.x86_64 : Development files for libmongo-client
libmongo-client-doc.x86_64 : Documentation for libmongo-client
mongo-c-driver.x86_64 : Client library written in C for MongoDB
mongo-c-driver-devel.x86_64 : Header files and development libraries for mongo-c-driver
mongo-c-driver-libs.x86_64 : Shared libraries for mongo-c-driver
mongo-cxx-driver.x86_64 : A legacy C++ Driver for MongoDB
mongo-cxx-driver-devel.x86_64 : MongoDB header files
nodejs-mongodb.noarch : A node driver for MongoDB
php-horde-Horde-Mongo.noarch : Horde Mongo Configuration
php-mongodb.noarch : MongoDB driver library
php-pecl-mongo.x86_64 : PHP MongoDB database driver
php-pecl-mongodb.x86_64 : MongoDB driver for PHP
php54-php-pecl-mongo.x86_64 : PHP MongoDB database driver
php54-php-pecl-mongodb.x86_64 : MongoDB driver for PHP
php55-php-pecl-mongo.x86_64 : PHP MongoDB database driver
php55-php-pecl-mongodb.x86_64 : MongoDB driver for PHP
php56-php-pecl-mongo.x86_64 : PHP MongoDB database driver
php56-php-pecl-mongodb.x86_64 : MongoDB driver for PHP
php70-php-pecl-mongodb.x86_64 : MongoDB driver for PHP
php71-php-pecl-mongodb.x86_64 : MongoDB driver for PHP
php72-php-pecl-mongodb.x86_64 : MongoDB driver for PHP
php73-php-pecl-mongodb.x86_64 : MongoDB driver for PHP
php74-php-pecl-mongodb.x86_64 : MongoDB driver for PHP
php80-php-pecl-mongodb.x86_64 : MongoDB driver for PHP
php81-php-pecl-mongodb.x86_64 : MongoDB driver for PHP
php82-php-pecl-mongodb.x86_64 : MongoDB driver for PHP
php83-php-pecl-mongodb.x86_64 : MongoDB driver for PHP
poco-mongodb.x86_64 : The MongoDB POCO component
python-mongoengine.noarch : A Python Document-Object Mapper for working with MongoDB
python-pymongo.x86_64 : Python driver for MongoDB
python-pymongo-gridfs.x86_64 : Python GridFS driver for MongoDB
python36-pymongo.x86_64 : Python driver for MongoDB
python36-pymongo-gridfs.x86_64 : Python GridFS driver for MongoDB
syslog-ng-mongodb.x86_64 : mongodb support for syslog-ng
autocorr-mn.noarch : Mongolian auto-correction rules
hunspell-mn.noarch : Mongolian hunspell dictionaries
hyphen-mn.noarch : Mongolian hyphenation rules
rubygem-moped.noarch : A MongoDB driver for Ruby

  Name and summary matches only, use "search all" for everything.
You have mail in /var/spool/mail/root


4、因为我的PHP环境是 PHP 7.4  所以 取得

php74-php-pecl-mongodb.x86_64 : MongoDB driver for PHP

5、执行安装对应 PHP版本的 yum 安装

yum install -y php74-php-pecl-mongodb.x86_64

6、执行结果

[root@game-test xxx]# yum install php74-php-pecl-mongodb.x86_64
Loaded plugins: fastestmirror
Existing lock /var/run/yum.pid: another copy is running as pid 20001.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  83 M RSS (405 MB VSZ)
    Started: Fri Nov 17 18:00:53 2023 - 00:05 ago
    State  : Sleeping, pid: 20001
Loading mirror speeds from cached hostfile
 * remi-safe: cdn.centos.no
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
--> Running transaction check
---> Package php74-php-pecl-mongodb.x86_64 0:1.17.0-1.el7.remi will be installed
--> Processing Dependency: libutf8proc.so.1()(64bit) for package: php74-php-pecl-mongodb-1.17.0-1.el7.remi.x86_64
--> Running transaction check
---> Package utf8proc.x86_64 0:1.3.1-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================
 Package                                  Arch                     Version                              Repository                   Size
==========================================================================================================================================
Installing:
 php74-php-pecl-mongodb                   x86_64                   1.17.0-1.el7.remi                    remi-safe                   817 k
Installing for dependencies:
 utf8proc                                 x86_64                   1.3.1-2.el7                          epel                         63 k

Transaction Summary
==========================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 880 k
Installed size: 3.2 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): utf8proc-1.3.1-2.el7.x86_64.rpm                                                                             |  63 kB  00:00:00     
(2/2): php74-php-pecl-mongodb-1.17.0-1.el7.remi.x86_64.rpm                                                         | 817 kB  00:00:01     
------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                     671 kB/s | 880 kB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : utf8proc-1.3.1-2.el7.x86_64                                                                                            1/2 
  Installing : php74-php-pecl-mongodb-1.17.0-1.el7.remi.x86_64                                                                        2/2 
  Verifying  : php74-php-pecl-mongodb-1.17.0-1.el7.remi.x86_64                                                                        1/2 
  Verifying  : utf8proc-1.3.1-2.el7.x86_64                                                                                            2/2 

Installed:
  php74-php-pecl-mongodb.x86_64 0:1.17.0-1.el7.remi                                                                                       

Dependency Installed:
  utf8proc.x86_64 0:1.3.1-2.el7                                                                                                           

Complete!

7、验证是否安装成功

[root@game-test xxx]# php -m|grep mongo
mongodb
[root@game-test xxx]#


安装成功


8、重启PHP

systemctl restart php74-php-fpm


云天阁
非我而当者,吾师也;是我而当者,吾友也;谄谀我者,吾贼也。
搜索