&reftitle.install;
&pecl.moved;
&pecl.info;
&url.pecl.package;mongo.
Installing on *NIX
Run:
Add the following line to your php.ini file:
If pecl runs out of memory, make sure memory_limit in php.ini is set to at least 32M.
Manual InstallationFor driver developers and people interested in the latest bugfixes, you
can compile the driver from the latest source on
Github.
Go to Github and click the "download" button. Then run:
.tar.gz
$ cd mongodb-mongodb-php-driver-
$ phpize
$ ./configure
$ sudo make install
]]>
Make the following changes to php.ini:
1. The build will display where it is installing the PHP driver with output that looks something like:
Make sure that it is the same as the PHP extension directory by runnning:
/usr/lib/php/extensions/no-debug-zts-20060613 =>
/usr/lib/php/extensions/no-debug-zts-20060613
]]>
If it's not, change the extension_dir in php.ini or move mongo.so.
2. To load the extension on PHP startup, add a line:
OS X
If your system is unable to find autoconf, you'll need to install Xcode
(available on your installation DVD).
If you are using XAMPP, you may be able to compile the driver with the
following command:
If you are using MAMP (or XAMPP and the above command does not work),
precompiled binaries are available from
Github
(download the latest one with "osx" in the name that matches your version of
PHP). Extract mongo.so from the archive and add it to MAMP or XAMPP's
extension directory. Add
to the php.ini file being used and restart the server.
GentooOn Gentoo using PECL you might get an error that libtool is the wrong
version. Compiling from source you'll need to run aclocal and autoconf.
(Thanks to @riklaunim)
Fedora
If you don't want to modify php.ini directly, you can create a separate
mongo.ini file. Within the /etc/php.d directory, create a subdirectory named
mongo (or something else you like). In the mongo directory, create a
mongo.ini file. Put the following in your mongo.ini file:
Installing on Windows
Precompiled binaries are available for a variety of combinations of versions,
thread safety, and VC libraries. Unzip the archive and put php_mongo.dll in
your PHP extension directory ("ext" by default).
PHP 5.3 VC8 and VC9 Mongo extension
PHP 5.2 and 5.3 VC6 Mongo extension
(you have to search the page for "mongo")
The latest (non-release) code is compiled into Windows binaries on every
commit. The zip consists of a .zip with php_mongo.dll and a version.txt.
Please keep the version.txt around so that if you have a question or problem,
you can give the developers the exact version you're using. (The number is
long and nonsensical, but it will make sense to the developers!)
To get the latest bug fixes (and possibly bugs), download the binary
corresponding to the PHP you have installed:
PHP 5.3 VC8 Non-Thread-Safe Mongo extension
PHP 5.3 VC8 Thread-Safe Mongo extension
PHP 5.3 VC9 Non-Thread-Safe Mongo extension
PHP 5.3 VC9 Thread-Safe Mongo extension
Add the following line to your php.ini file:
Third-Party Installation Instructions
A number of people have created excellent tutorials on installing the PHP
driver.
PHP 5.3.1 with Xdebug, MongoDB and Lithium on Ubuntu 9.10 / Apache 2.2
An excellent video that takes you step-by-step through installing
Apache, PHP, Xdebug, MongoDB, and Lithium by Jon Adams.
Installing MongoDB and the PHP driver on Ubuntu 9.04
Spanish article by Javier Aranda (
English translation).
OS X: Installing MongoDB and the PHP Mongo Driver
By Matt Butcher.