meepo sf
meepo sf

Reputation: 43

MongoDB PHP driver not working on Ubuntu AWS

I'm trying to install the MongoDB PHP driver Using PHP 7.2 on AWS EC2 Ubuntu. I used sudo pecl install mongodb. it seems to have installed without any errors.

However, when loading phpinfo() I don't see any reference to Mongo. When I try to run:

$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");

Fatal error: Uncaught Error: Class 'MongoDB\Driver\Manager' not found in /var/www/html/website/test.php:3 Stack trace: #0 {main} thrown in /var/www/html/website/test.php on line 3

I did put in extension=mongodb.so into my php.ini

I'd appreciate assistance as to why this isn't working.

Upvotes: 1

Views: 529

Answers (1)

meepo sf
meepo sf

Reputation: 43

I tried to install driver using

sudo apt-get install php-mongodb

and it works.

Upvotes: 1

Related Questions