Adding Mongo DB driver to XAMPP

Like 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).

  1. First download and install Mongo db from
  2. Secondly download the PHP MongoDB driver source from
  3. Now to compile the code
    1. You need phpize to compile the source code, so install php5-devpackage by running `sudo apt-get install php5-dev`
    2. Navigate into the mongo-php-driver directory and run `phpize` on the terminal
    3. Then run `./configure` to check for dependencies
    4. Run `make` to build the package
  4. Assuming XAMPP is installed at `/opt/lampp/` copy `` and `` from `modules` directory inside mongo-php-driver directory to `/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/` directory
  5. Add the line `` to  `/opt/lampp/etc/php.ini`
  6. Start mongodb and xampp servers and run the program test program from to check if it is working


8 Comments on “Adding Mongo DB driver to XAMPP”

  1. […] The above steps only for those installed php,apache separtely, not  for xampp. If you are using Xampp follow this link […]

  2. Imran Bukhsh says:


    I followed your steps and I am getting the following error:

    Warning: PHP Startup: Unable to load dynamic library ‘/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/’ – /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/ wrong ELF class: ELFCLASS64 in Unknown on line 0

    I am using the 64 bit of ubuntu

    • Gautam Kumar says:

      The problem is quite easy to figure out from the error itself.
      Xampp is compiled for 32bit systems , but when you compile on a 64bit system you get a 64bit version of the driver , So you cannot use them together .

      So try compiling it on a 32bit system and using that .

  3. piperoman says:

    I have a Issue in Step5: Add the line `` to `/opt/lampp/etc/php.ini`

    When I add the line, and restart lampp, php doesn’t work. When I go in navigator to my info.php, try to download-it. Only work when I comment that line.

    I have lampp in 32 bits, I have compiled mongo-php-driver with 32 bits flag, and followed all the steps. I tried put: extension_dir=/path/to/no-debug-non-zts-20090626. And use extension complete path: extension=/path/to/no-debug-non-zts-20090626/

    Any idea?

  4. nabin kunwar says:

    Warning: PHP Startup: Unable to load dynamic library ‘/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/’ – /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/ undefined symbol: zend_new_interned_string in Unknown on line 0

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s