Well, here is the strange situation I found. I use PHP and MongoDB together on a project and update the corresponding software. After the update, I definitely updated the new conf files, and everything is fine - except when I try to use the MongoClient class, I get the following fatal error:
Fatal error: impure error: class "MongoClient" not found in /srv/http/test.php
So my first instinct was to check my /etc/php/php.ini to make sure mongodb.so was turned on correctly. I found it after other extension lines:
extension=mcrypt.so extension=zip.so extension=mongodb.so ; <--- here it is
With this noted, I downloaded a quick phpinfo() script to verify that I used the correct php.ini and confirmed that I am. And not only that, the mongodb driver also looks properly loaded!
Loaded Configuration File /etc/php/php.ini . . . mongodb support enabled mongodb version 1.1.1 mongodb stability stable libmongoc version 1.3.1-dev libbson version 1.3.0
So, I restarted httpd and tried again. No dice, still unable to find the MongoClient class. So I tried installing it from pecl instead of my distribution package manager, and the situation is the same as described above.
So here is a summary of the situation:
- Linux Kernel 4.3.3
- PHP Version 7.0.1
- php-mongodb version 1.1.1
- It seems to be configured correctly and mongodb is enabled and shown in
phpinfo() . - I tried installing the mongodb driver through
pecl and my distribution package manager.
Additional information that may be helpful:
- MongoDB Version 3.2.0
mongod works- Also tried to reboot, no change.
source share