HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
This tutorial shows you how to install MongoDB extension on Linux, window, Mac platform.
You can execute the following command to install MongoDB PHP extension in linux driver
$ sudo pecl install mongo
Php installation using the pecl command must ensure that the network connection is available as well as root privileges.
Installation ManualIf you want to compile the source code by the extended drive. You have to manually compile the source package, this is a good bug is included in the latest revised source package.
You can download the MongoDB PHP driver package on Github. Access github website and then search for "mongo php driver" (Download: https://github.com/mongodb/mongo-php-driver ), download the source package, and then execute the following command:
$ tar zxvf mongodb-mongodb-php-driver-<commit_id>.tar.gz $ cd mongodb-mongodb-php-driver-<commit_id> $ phpize $ ./configure $ sudo make install
If your php compiled yourself, the installation method is as follows (assuming the compiler in / usr / local / php directory):
$ tar zxvf mongodb-mongodb-php-driver-<commit_id>.tar.gz $ cd mongodb-mongodb-php-driver-<commit_id> $ /usr/local/php/bin/phpize $ ./configure --with-php-config=/usr/local/php/bin/php-config $ sudo make install
After executing the above command, you need to modify the php.ini file, add mongo configuration in the php.ini file, configuration is as follows:
extension=mongo.so
Note: You need to specify the path extension_dir configuration items.
On Github has provided precompiled php mongodb window platform for driving binary packages (Download: https://s3.amazonaws.com/drivers.mongodb.org/php/ ), you can download your php the corresponding version, but you need to pay attention to the following questions:
Open the php configuration file php.ini add the following configuration:
extension=php_mongo.dll
Restart the server.
Phpinfo access through a browser, if the installation is successful, you will see the following types of information:
You can use the 'autoconf' install MongoDB PHP driver extensions.
You can use the 'Xcode' install MongoDB PHP driver extensions.
If you are using XAMPP, you can use the following command to install MongoDB PHP driver extensions:
sudo /Applications/XAMPP/xamppfiles/bin/pecl install mongo
If the above command in XMPP or MAMP does not work, you need to download on Github compatible precompiled packages.
Then add the 'extension = mongo.so' to your php.ini configuration file.