Wednesday, 2 January 2013

Install the right version of php_mongo.dll in windows


I use a macbook pro for my freelance work, a ubuntu netbook while travelling and forced to use a windows box at work.

I have been recently working a lot with Mongo DB and Drupal, I installed Mongo and php drivers for mongodb without any problems on Mac and Linux, I struggled to get the correct version of php_mongo.dll on my windows box. Installing php_mongo.dll becomes very simple if you find the right version of the dll file.

To find the right version, you need to ensure you look at your current configuration, note these steps these will be helpful.

use phpinfo() to find out the following information:

PHP Version
Compiler
Architecture
Server Software

For instance my local machine was a x64 machine running windows 7 pro, however the version of PHP installed was a 32bit. By phpinfo() shows me following:

PHP Version: 5.4.x
Compiler: MSVC9 (Visual C++ 2008)
Architecture: x86
SERVER_SOFTWARE: Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7

Notice from above I am running PHP major version "5.4", compiled with "VC9", with "x86" architecture and "Win32" (server software).

If you download the php mongo windows pre compiled binary from https://github.com/mongodb/mongo-php-driver/downloads extract and look at various files find thread safe version with 5.4 and VC9.

Hope this helps someone.

No comments:

Post a Comment