Installing MongoDB driver for PHP on Windows

@Chanaka_Niroshana when installing DLLs for Windows, it is important to grab the correct file that corresponds to your PHP environment. This not only includes the PHP version itself, but also the architecture (x86 vs. x64) and thread safety. Quoting from our Windows DLL FAQ:

Ensure that you have downloaded a DLL that corresponds to the following PHP runtime properties:

  • PHP version (PHP_VERSION)
  • Thread safety (PHP_ZTS)
  • Architecture (PHP_INT_SIZE)

We do provide a script that should help you detect the extension as part of the PHP library. You can grab a copy of it and run it locally: mongo-php-library/tools/detect-extension.php at master · mongodb/mongo-php-library · GitHub

The FAQ page I linked above contains some more information about the tool. Note that while the tool still refers to PECL for obtaining Windows DLLs, they are now published as part of our GitHub releases. I’ll make sure the tool is updated accordingly.

1 Like