Database Reference
In-Depth Information
Installing the PHP Driver on Unix-Based Platforms Manually
If you would prefer to compile the driver yourself or for some reason are unable to use
the PECL application as described previously (your hosting provider might not support
this option, for instance), then you can also choose to download the source driver and
compile it manually.
To download the driver, go to the github website ( http://github.com ) . This site
offers the latest source package for the PHP driver. Once you download it, you will need to
extract the package, and make the driver by running the following set of commands:
$ tar zxvf mongodb-mongdb-php-driver-<commit_id>.tar.gz
$ cd mongodb-mongodb-php-driver-<commit_id>
$ phpize
$ ./configure
$ sudo make install
This process can take a while, depending on the speed of your system. Once the
process completes, your MongoDB PHP driver is installed and ready to use! After you
execute the commands, you will be shown where the driver has been placed; typically,
the output looks something like this:
Installing '/ usr/lib/php/extensions/no-debug-zts-20060613/mongo.so'
You do need to confirm that this directory is the same directory where PHP stores its
extensions by default. You can use the following command to confirm where PHP stores
its extensions:
$ php -i | grep extension_dir
This line outputs the directory where all PHP extensions should be placed. If this
directory doesn't match the one where the mongo.so driver was placed, then you must
move the mongo.so driver to the proper directory, so PHP knows where to find it.
As before, you will need to tell PHP that the newly created extension has been placed
in its extension directory, and that it should load this extension. You can specify this by
modifying the php.ini file's extensions section; add the following line to that section:
extension=mongo.so
Finally, a restart of your web service is required. When using the Apache HTTPd
service, you can accomplish this using the following service command:
sudo /etc/init.d/apache2 restart
That's it! This process is a little lengthier than using PECL's automated method;
however, if you are unable to use PECL, or if you are a driver developer and interested in
bug fixes, then you would want to use the manual method instead.
 
Search WWH ::




Custom Search