Home > Backend Development > PHP Tutorial > Tutorial on installing mongoDB extension methods in php7

Tutorial on installing mongoDB extension methods in php7

巴扎黑
Release: 2023-03-14 17:40:01
Original
1861 people have browsed it

This article mainly introduces the method of installing the mongoDB extension in php7. It briefly analyzes the steps and related configuration operation skills of installing the MongoDB extension in php7. Friends in need can refer to the following

This article describes the installation of the mongoDB extension in php7 Methods. Share it with everyone for your reference, the details are as follows:

Here we use the pecl command to install

First go to the installation directory of php7


$ /usr/local/php7/bin/pecl install mongodb
Copy after login

Press Enter. After successful execution, the following results will be output:


……
Build process completed successfully
Installing '/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/mongodb.so'
install ok: channel://pecl.php.net/mongodb-1.1.7
configuration option "php_ini" is not set to php.ini location
You should add "extension=mongodb.so" to php.ini
Copy after login

Next we need to open the php.ini file and add extension=mongodb.so configuration

Or directly execute the following command to add:

The code is as follows:

$ echo "extension=mongodb.so" >> `/usr/local/php7/bin/php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
Copy after login

After configuring the above, you are done. Execute phpinfo(). If you see mongoDB, then congratulations , the installation is successful. If you don’t see it, please consciously check your development environment.

Note: In the command executed above, the installation directory of php7 is /usr/local/php7/. If you install it in another directory, you need to modify the paths of pecl and php commands accordingly.

The above is the detailed content of Tutorial on installing mongoDB extension methods in php7. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template