PHP startup mongo: Unable to initialize module PHP startup mongo: Unable to initialize module mongodb mongodb

PHP startup mongo: Unable to initialize module


It looks like you're trying to install an extension compiled for PHP 5.3 with PHP 5.4; the module API version needs to match the version of PHP.

If you download the precompiled MongoDB PHP driver from Github (eg. php_mongo-1.2.12.zip is the current stable version) it includes DLLs for multiple PHP versions (eg 5.2, 5.3, and 5.4). You need to copy the correct DLL for your system and rename it php_mongo.dll.

You can determine the required version from the phpinfo() output on your system (or php -i from a command line). Check the value for "Zend Extension Build".

For example:

Zend Extension Build => API220100525,NTS,VC9

.. would indicate you should use the NTS (Non-threadsafe) DLL.

On 64-bit Windows, that would mean copying php_mongo-1.2.12-5.4-vc9-nts-x86_64.dll to php_mongo.dll in your PHP extension directory.