Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Startup Unable to load dynamic library php_mongo.dll

Tags:

php

mongodb

dll

I'm a beginner for this. I'm trying to install mongodb driver on php.

Platform: Windows 8.1 64bit.
PHP 5.5.9
Apache/2.4.7

Followed the instruction here:http://php.net/manual/en/mongo.installation.php#mongo.installation.windows

I've tried all php_mongo.dll file with VC11 and put in php/ext folder. and added extension=php_mongo.dll in php.ini file but when I tried to start apache in xampp controller I got an error.

    Php Startup: Unable to load dynamic library
  'C:\xampp\php\ext\php_mongo.dll' -%1 is not a valid Win32 application.

I've already check my VC compilator version inside phpinfo() and it's stated there MSVC11 with architecture: x86.

it would be nice if someone can help me. Thanks. appreciate it.

like image 821
blitzen12 Avatar asked Aug 01 '14 08:08

blitzen12


2 Answers

Make sure you download the correct .DLL for your PHP installation. Good chance you're running apache x86, so download an x86 php_mongo.dll. Also if you're running PHP as an Apache module, make sure you pick the thread safe (ts) one and also pick this type of dll that matches the PHP version you're running.

The versions must match or else you will get a php startup error. Find these Mongo DLLs here.

I did this then I got an error libsasl.dll not found. I simply copied the libsasl.dll found in my PHP installation directory to the Apache installation directory (where httpd.exe is found). Then I restarted my Apache and it worked!

like image 185
Kimutai Avatar answered Sep 28 '22 00:09

Kimutai


For anyone googling this in 2017, the PECL Package has been updated and is now found at http://pecl.php.net/package/mongodb/1.2.9/windows

and use:

extension=php_mongodb.dll 

instead of:

extension=php_mongo.dll
like image 35
bzzhuh Avatar answered Sep 27 '22 23:09

bzzhuh