- I have downloaded and installed MongoDB.
- I can interact with my db via the
mongo
shell. - I have installed the PHP extension through
sudo pecl install mongo
- I confirmed that
mongo.so
is in the folder defined byextension_dir
in php.ini. - I have confirmed that
extension=mongo.so
is defined in php.ini. - I confirmed that the php.ini file I edited is the php.ini file being loaded for configuration via
phpinfo()
.
Yet when I try to instantiate a new MongoClient, my script fails silently. And I when I try to run a command like php --rc MongoClient
, I receive an error that the class does not exist. I have restarted apache (MAMP) and the computer and reverified config files multiple times. As I can use mongodb and mongo, I assume this is a PHP configuration issue, but I've double checked config multiple times. Any ideas?
Edit: php_error.log output:
[20-Aug-2014 18:54:03 Europe/Berlin] PHP Fatal error: Class 'MongoClient' not found in /Applications/MAMP/htdocs/pantry/application/controllers/mongodb.php on line 14
[20-Aug-2014 18:54:56 Europe/Berlin] PHP Warning: PHP Startup: mongo: Unable to initialize module
Module compiled with module API=20100525
PHP compiled with module API=20121212
These options need to match in Unknown on line 0
The issue now is clear, but I do not how to resolve it.