I'm trying to install the MongoDB PHP driver so I can connect to a MongoDB Server on another machine. Using PHP 5.6 on AWS Linux.
I used sudo pecl install mongodb
. Initially there were several errors regarding dependencies but I added them all and it then seems to have installed without any errors.
However, when loading phpinfo()
I don't see any reference to Mongo. When I try to run:
$connection = new MongoClient();
I get
PHP Fatal error: Class 'MongoClient' not found in /var/www/html/mongo.php on line 3
I did put in extension=mongodb.so
into my php.ini but that results in another error:
PHP Startup: Unable to load dynamic library '/usr/lib64/php/5.6/modules/mongodb.so' - /usr/lib64/php/5.6/modules/mongodb.so: undefined symbol: php_json_serializable_ce in Unknown on line 0
It seems this error has to do with the order in which json loads relative to MongoDB. But as in my case it doesn't appear MongoDB is loading at all I'm not sure if that applies here.
I'd appreciate assistance as to why this isn't working.