Compile MongoDB PHP Driver in Mac OSX

If you want to compile mongodb php driver in Mac OSX , first you need to install XCode first.

1. Open the Xcode > Preferences > Downloads > Install Command Line Tools 2. Create the build-essential.sh under your home folder. Add following code in build-essential.sh

3. Open the terminal and

sudo sh ~/build-essential.sh

it will install m4 , autoconf, automake and libtool.

4. Download the mongodb php driver from github .

5. Unzip the file after downloading.

6. Go to downloaded folder from terminal.

cd ~/Downloads/mongo-php-driver-master

7. Compile it.

export PATH=$PATH:~/local/bin/
phpize
./configure
make
sudo make install

After compiling you will get mongodb.so and copy to your php extension folder.

add

extension=mongo.so

in php.ini.

Restart apache.

sudo apachectl restart
comments powered byDisqus