Adding Mongo DB driver to XAMPP
Posted: January 26, 2012 Filed under: Linux, Techno irrelevency ., Ubuntu, Web 2.0 | Tags: database, drivers, internet, linux, mongo, mongodb, open, opensource, php, php extensions, source, tutorial, ubuntu, web, xampp 8 CommentsLike many developers I use XAMPP for PHP development. But adding PHP extensions in xampp to does not seem to have a direct procedure . So when I wanted mongodb drivers I was on my own to figure out how to get it working . Here is the knowledge I gained .
I am using Ubuntu oneiric ocelot machine so this procedure is similar for all *NIX machines (Sorry windows users but the procedure must similar).
- First download and install Mongo db from mongodb.org/downloads
- Secondly download the PHP MongoDB driver source from github.com/mongodb/mongo-php-driver
- Now to compile the code
- You need phpize to compile the source code, so install php5-devpackage by running `sudo apt-get install php5-dev`
- Navigate into the mongo-php-driver directory and run `phpize` on the terminal
- Then run `./configure` to check for dependencies
- Run `make` to build the package
- You need phpize to compile the source code, so install php5-devpackage by running `sudo apt-get install php5-dev`
- Assuming XAMPP is installed at `/opt/lampp/` copy `mongo.so` and `mongo.la` from `modules` directory inside mongo-php-driver directory to `/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/` directory
- Add the line `extension=mongo.so` to `/opt/lampp/etc/php.ini`
- Start mongodb and xampp servers and run the program test program from php.net/manual/en/mongo.tutorial.php to check if it is working