MongoClient not found in WAMP

2019-02-25 22:26发布

I have been trying to run MongoDB on WAMP all day and It shows the error: Fatal Error: MongoClient class not found. I have a windows 64 bit, Wamp 32 bit ( after trying and failing at running wamp 64), MongoDB 64 bit. I downloaded mongo php_driver from https://s3.amazonaws.com/drivers.mongodb.org/php/index.html. Copied php_mongo-1.5.1-5.4-vc9.dll to the php extension folder as php_mongo.dll. Added it as extension in php.ini (configuration setting file). My php.ini extension section looks like this:

extension=php_bz2.dll
extension=php_curl.dll
extension=php_com_dotnet.dll
extension=php_fileinfo.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_gmp.dll
extension=php_intl.dll
extension=php_imap.dll
;extension=php_interbase.dll
extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll      ; Must be after mbstring as it depends on it
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client
;extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client
extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
extension=php_shmop.dll
extension=php_mongo.dll

I've reboot the server. I don't see Mongo on the phpinfo() file and also the php error log files shows the following:

c:/wamp/bin/php/php5.5.12/ext/php_intl.dll' - The specified module could not be found.
 PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.5.12/ext/php_ldap.dll' - %1 is not a valid Win32 application.

PHP Warning: PHP Startup: mongo: Unable to initialize module

Please tell me what I am missing because I have tried everything.

Thank you!

1条回答
ゆ 、 Hurt°
2楼-- · 2019-02-25 23:05

To fix the php_intl.dll error do the following using the wmapmanager menus

wampmanager -> Apache -> Version -> and click on the 2.4.9 version number

This will cause wampmanager to rebuild all the SYMLINKS in the \wamp\bin\apache\apache2.4.9\bin folder.

As to the mongo error, are you sure you are editing the correct php.ini file.

Again use the wampmanager menu system to edit the correct php.ini file

wampmanager -> PHP -> php.ini

I expect the extension was not added to this file so add

extension=php_mongo.dll

like you did to the PHP CLI version of the ini file.

查看更多
登录 后发表回答