Home > Article > Backend Development > How to install mongodb php extension
How to install the mongodb php extension: first open the download address and download the "php-mongodb" extension; then compile and install it; finally add the mongo configuration in the "php.ini" file.
3: No need to compile, it is a compiled binary executable file.
4: Start mongod service./bin/mongod --dbpath /path/to/database --logpath /path/to/log --fork --port 27017Parameter explanation:--dbpath data storage directory--logpath log storage directory--port run Port (default 27017)--fork background process running./bin/mongod –dbpath /home/mdb –logpath /home/mlog/m1.log –fork –port 27017 – smallfiles./bin/mongo
#Connect to server:
Mongodb php extensions
pecl.php.net
2. Download php-mongodb extension
3. Mongodb-1.1.6 download address:
http:/ /pecl.php.net/get/mongo-1.6.13.tgz4. Compilation and installation:
$ tar zxvf mongodb -mongodb-php-driver-8d1b22a77b769a48fdbfec0e6ff2a168.tar.gz$ cd mongodb-mongodb-php-driver-8d1b22a77b769a48fdbfec0e6ff2a168
[root@localhost mongo-1.6.13]# /usr/local /php5.6/bin/phpize[root@localhost mongo-1.6.13]# ./configure --with-php-config=/usr/local/php5.6/bin/php-config
[root@localhost mongo-1.6.13]# make && make install
After successful compilation:
##/usr/local/php5.6/lib/php/extensions/no-debug-non-zts-20131226/
5
, findphp.ini
file:find / -name php.iniVim /etc/php.ini##Add a line: extension=/usr/ local/php5.6/lib/php/extensions/no-debug-non-zts-20131226/
mongo.so
Execute After the above command, you need to modify the php.ini file and add mongo in the
php.ini file Configuration, the configuration is as follows: ##Note: You need to specify the
extension_dir path to the configuration item.
6. Finally check whether phpinfo() is installed successfully: For more related knowledge, please visit PHP Chinese website!
The above is the detailed content of How to install mongodb php extension. For more information, please follow other related articles on the PHP Chinese website!