supert3d
supert3d

Reputation: 55

Loading Mongo Driver 1.6.x driver on WAMP 64bit architecture

So I've installed 64bit Apache/PHP locally. Both Apache and PHP were compiled against the VC11 C++ redistributable.

Both work fine! (screenshots with version and architecture info inc.)

I've downloaded multiple varaities of the 1.6.x driver from both PECL and an repo' at Amazon.

I've made sure they're the x64 Thread Safe variety and added to my ~/php/ext folder.

I've made sure the extension is loaded in php.ini (and that the write .ini file is called): extension=php_mongo-1.6.8-5.6-vc11-x86_64.dll

But everytime I restart Apache I get this in my PHP error log:

[07-Jun-2017 20:21:20 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'E:\PHP5.6\ext\php_mongo-1.6.8-5.6-vc11-x86_64.dll' - %1 is not a valid Win32 application.

(Apache comes up clean. Error.log clean)

Why is it protesting that this is not a Win32 Application. I don't want it to be. My entire architecture is 64bit and so is the Mongo Driver.

enter image description here enter image description here

Upvotes: 0

Views: 391

Answers (3)

supert3d
supert3d

Reputation: 55

From php.net

In order for this extension to work, there are DLL files that must be available to the Windows system PATH. For information on how to do this, see the FAQ entitled "How do I add my PHP directory to the PATH on Windows". Although copying DLL files from the PHP folder into the Windows system directory also works (because the system directory is by default in the system's PATH), this is not recommended. This extension requires the following files to be in the PATH: libsasl.dll

Simply copy libsasl.dll from your PHP directory to your Apache\bin directory and restart Apache.

Upvotes: 1

Derick
Derick

Reputation: 36784

It is possible that a dependency is missing. Where I suspect that to be libsasl as alluded to in the comment at http://php.net/manual/en/mongodb.requirements.php

The libsasl.dll can be found in the PHP distribution.

Upvotes: 0

supert3d
supert3d

Reputation: 55

In case anyone else comes across this thread. After hours of trying to get it to run I just downgraded everything to 32-bit. Worked right out the gate.

Despite PECL offering a "64bit" driver - https://pecl.php.net/package/mongo/1.6.14/windows it didn't seem to be compatible with 64bit/VC11/Thread Safe versions of Apache/PHP

I'm not sure if this is an issue with the Mongo driver compilation or something deeper?

Anyway. Downgrade to 32-bit. Mongo 1.6.x drivers will then run.

Upvotes: 1

Related Questions