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
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
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*||"`
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!