mongodb / laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)
https://www.mongodb.com/docs/drivers/php/laravel-mongodb/
MIT License
7.02k stars 1.43k forks source link

Unsupported driver [mongodb] #1593

Closed mojo2405 closed 4 years ago

mojo2405 commented 6 years ago

Hi, I searched all possible solutions out there, but I'm still getting this annoying error. I'm using : Centos 6.9 PHP 5.6.30 Laravel 5.4

Mongo extension is installed :

php -m | grep mongo mongo

I user laravel-mongodb v 3.2.23 I put inside config/app.php providers => [ .. Jenssegers\Mongodb\MongodbServiceProvider::class, ..]

When trying the API I'm getting : Unsupported driver [mongodb]

my model looks like this :

use Jenssegers\Mongodb\Eloquent\Model as Eloquent;

class Notification extends Eloquent { protected $connection = 'mongodb'; }

I'm not using Lumen. Any help will be appriciated.

raypanjaitan commented 6 years ago

Have you tried to update your php? It seems like laravel 5.4 needs minimum 5.6.4 version of PHP.

Opt 2: Try to use alias, add an alias for the model class by adding this code 'Moloquent' => Jenssegers\Mongodb\Eloquent\Model::class, to your config/app.php and use the alias to extends your model.

If none of it works, I suggest you to try to call your database by using query builder.

mojo2405 commented 6 years ago

none of those helped :(

StevePorter92 commented 6 years ago

What version of the php-mongodb extension do you have installed?

There is a legacy mongo and modern mongodb extension and php library. It looks like you may have the legacy one. You can find more information here https://docs.mongodb.com/ecosystem/drivers/php/#drivers