Since the module is not included with the default PHP installation, you have to download it from the official repository:
cd mkdir mongo-php-driver cd mongo-php-driver curl https://codeload.github.com/mongodb/mongo-php-driver/zip/master > mongo-php-driver-master.zip Unzip it
unzip mongo-php-driver-master.zip cd mongo-php-driver-master You need _phpize _to build the module. You can install it from the remi repository:
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6.rpm yum --enablerepo=remi install php-devel Configure and build
phpize ./configure make all sudo make install Make sure the installation directory is the same as the PHP extension directory by running:
The first step is to configure the repositories. Create the following file /etc/yum.repos.d/10gen.repo with the following contents:
For 32-bit systems:
[10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686 gpgcheck=0 enabled=1 For 64-bit systems:
[10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 gpgcheck=0 enabled=1 Install Mongo
yum install mongo-10gen mongo-10gen-server Configure MongoDB You can configure Mongo by editing the following file:
/etc/mongod.conf Set Mongo to autostart on system boot:
chkconfig mongod on Start Mongo
service mongod start Stop Mongo
Installing PHP/MongoDB extension is a two steps task on OSX:
Install the autoconf tool required for compiling the extension Install the Mongo extension You have to install autoconf in order to avoid the following error:
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script. ERROR: `phpize’ failed Enough talk, hands on work…
Step 1. Install the autoconf tool Download the latest source version: