Linux installs the PHP MongoDB driver

  • 2020-05-12 06:44:38
  • OfStack

PHP is easy to learn and widely used. It is mainly suitable for the development of Web.

The main goal of MongoDB is to bridge the gap between key/value storage (which provides high performance and high scalability) and the traditional RDBMS system (which is rich in functionality).

To use mongodb in php you must use the php driver of mongodb.

This article is a brief record of the site when it deploys a production environment.

1. Download the mongodb driver installation package mongodb-1.1.9.tgz for PHP

wget https://pecl.php.net/get/mongodb-1.1.9.tgz

2. Unzip drive installation package

tar zxf ./mongodb-1.1.9.tgz

3. Install the driver

pecl install mongodb

4. Add in php.ini

extension = "mongodb. so"

5. Restart php - fpm

/etc/init.d/php-fpm restart

At this point, you can use the MongoDB driver normally, and remember to turn on the MongoDB server when using it.


Related articles: