search
HomeBackend DevelopmentPHP7How to install mongodb extension in php7

How to install mongodb extension in php7

Aug 17, 2020 am 09:25 AM
mongodbphp7

How to install the mongodb extension in php7: First download the mongodb extension file; then decompress, compile and install; then modify the php configuration file and add the "mongodb.so" extension configuration; finally restart the php-fpm service.

How to install mongodb extension in php7

Recommended: "PHP Video Tutorial"

PHP7 Add Mongodb extension and install Mongodb

When I compiled and installed php7 before, the mongo extension was not added. Now I need to debug the program and require php to support the mongo extension. Checked the relevant files and successfully installed the extension.

1: Install Mongodb

1. First download the compressed package from the official website: https://www.mongodb.com/download-center?jmp=nav#community

Unzip the package file:

tar -zxvf mongodb-osx-x86_64-enterprise-3.4.2.tgz

Create the specified folder and copy the code there:

mkdir -p mongodb
cp -R -n mongodb-osx-x86_64-enterprise-3.4.2/ mongodb

Create environment variables:

export PATH=<mongodb-install-directory>/bin:$PATH

Create a data folder for mongodb.

mkdir -p /data/db

Start the service (--dbpath specifies the data folder path):

mongod --dbpath <path to data directory>

2: Install the Mongodb extension

1. Download the extension file: http://pecl. php.net/package/mongodb

Decompress, compile and install:

tar -zxf mongodb-1.2.8.tgz
cd mongodb-1.2.8/
phpize
./configure --with-php-config=/urs/bin/php-config
make && make install

Modify the php configuration file and add the mongodb.so extension configuration

vim /etc/php.ini
extension=mongodb.so

Restart the php-fpm service

service php-fpm restart

The above is the detailed content of How to install mongodb extension in php7. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!