Database Reference
In-Depth Information
Figure 2-2. A short list of currently available language drivers for MongoDB
Next, select PHP from the list of languages and follow the links to download the latest (stable) version of the
driver. Different operating systems will require different approaches for installing the MongoDB extension for PHP
automatically. That's right; just as you were able to install MongoDB on Ubuntu automatically, you can do the same
for the PHP driver. And just as when installing MongoDB under Ubuntu, you can also choose to install the PHP
language driver manually. Let's look at the two options available to you.
Installing the PHP Driver on Unix-Based Platforms Automatically
The developers of PHP came up with a great solution that allows you to expand your PHP installation with other
popular extensions: PECL . PECL is a repository solely designed for PHP; it provides a directory of all known
extensions that you can use to download, install, and even develop PHP extensions. If you are already acquainted with
the package-management system called aptitude (which you used previously to install MongoDB), then you will be
pleased by how similar PECL's interface is to the one in aptitude.
Assuming that you have PECL installed on your system, open up a console and type the following command to
install the MongoDB extension:
$ sudo pecl install mongo
Entering this command causes PECL to download and install the MongoDB extension for PHP automatically.
In other words, PECL will download the extension for your PHP version and place it in the PHP extensions directory.
There's just one catch: PECL does not automatically add the extension to the list of loaded extensions; you will need
to do this step manually. To do so, open a text editor (vim, nano, or whichever text editor you prefer) and alter the
file called php.ini , which is the main configuration file PHP uses to control its behavior, including the extensions it
should load.
 
Search WWH ::




Custom Search