I installed Mongodb through brew on my mac and added the extension to php.ini, but the module does not get loaded after restarting XAMPP.
Mongo is installed:
me:~ me$ mongo --version
MongoDB shell version v3.6.4
git version: d0181a711f7e7f39e60b5aeb1dc7097bf6ae5856
OpenSSL version: OpenSSL 1.0.2o 27 Mar 2018
allocator: system
modules: none
build environment:
distarch: x86_64
target_arch: x86_64
Mongo is running:
me:~ me$ mongo
MongoDB shell version v3.6.4
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.4
> show dbs
admin 0.000GB
config 0.000GB
local 0.000GB
php.ini has correct extension_dir and extension:
me:~ me$ grep mongo /Applications/XAMPP/xamppfiles/etc/php.ini
extension=mongodb.so
me:~ me$ grep extension_dir /Applications/XAMPP/xamppfiles/etc/php.ini
; extension_dir = "./"
; extension_dir = "ext"
; Be sure to appropriately set the extension_dir directive.
extension_dir=/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20170718/
And the driver is there:
me:~ me$ ls /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20170718/
mongodb.so opcache.so pdo_dblib.so pgsql.so
opcache.a pdo_dblib.a pgsql.a
phpinfo() shows the correct extension_dir, but does not load the mongodb module and obviously therefore I can't use it. But xampp does not produce an error after restarting.
If someone has hints, I would be happy to hear so.
The issue is old PHP driving classes, you should use php-mongo package instead of the php-mongodb. How to resolve the issue goto /Applications/XAMPP/xamppfiles/bin and run sudo pecl install mongo-1.5.8 afer few seconds you will see Build with Cyrus SASL (MongoDB Enterprise Authentication) support? [no] : Type no and enter you will have to change your extension to mongo.so in php.ini
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.