Skip to content

Is MongoDB support Laravel Octane (FrankenPHP server) #2701

@gregsuper

Description

@gregsuper
  • Laravel-mongodb Version: 4.1.0
  • PHP Version: 8.1.2
  • Database Driver & Version: MongoDB 5.0.20

Other details:

  • Laravel Version: 10.39.0
  • Octane Version: 2.2.6

Description

When I run my trial Laravel 10 Octane server using FrankenPHP, I get the error Class "MongoDB\Driver\Manager" not found.
However, a similar octane server using Roadrunner works stably without failures (I just restart the octane server led by Roadrunner)

It is worth clarifying that MongoDB is installed correctly, otherwise roadrunner would not work, most likely the problem is in the compatibility of the MongoDB and FrankenPHP server.

Contacting the official octane repository: issues#798

A bit of stack error:
Class "MongoDB\Driver\Manager" not found {"exception":"[object] (Error(code: 0): Class \"MongoDB\\Driver\\Manager\" not found at /var/www/server.test/vendor/mongodb/mongodb/src/Client.php:117)
[stacktrace]
#0 /var/www/server.test/vendor/mongodb/laravel-mongodb/src/Connection.php(193): MongoDB\\Client->__construct('mongodb://127.0...', Array, Array)
#1 /var/www/server.test/vendor/mongodb/laravel-mongodb/src/Connection.php(64): MongoDB\\Laravel\\Connection->createConnection('mongodb://127.0...', Array, Array)
#2 /var/www/server.test/vendor/mongodb/laravel-mongodb/src/MongoDBServiceProvider.php(33): MongoDB\\Laravel\\Connection->__construct(Array)
#3 [internal function]: MongoDB\\Laravel\\MongoDBServiceProvider->MongoDB\\Laravel\\{closure}(Array, 'mongodb')
#4 /var/www/server.test/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(142): call_user_func(Object(Closure), Array, 'mongodb')
#5 /var/www/server.test/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(101): Illuminate\\Database\\DatabaseManager->makeConnection('mongodb')
#6 /var/www/server.test/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1819): Illuminate\\Database\\DatabaseManager->connection('mongodb')
#7 /var/www/server.test/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1785): Illuminate\\Database\\Eloquent\\Model::resolveConnection(NULL)
#8 /var/www/server.test/vendor/mongodb/laravel-mongodb/src/Eloquent/Model.php(589): Illuminate\\Database\\Eloquent\\Model->getConnection()
#9 /var/www/server.test/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1495): MongoDB\\Laravel\\Eloquent\\Model->newBaseQueryBuilder()
#10 /var/www/server.test/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1531): Illuminate\\Database\\Eloquent\\Model->newModelQuery()
#11 /var/www/server.test/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1484): Illuminate\\Database\\Eloquent\\Model->newQueryWithoutScopes()
#12 /var/www/server.test/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2334): Illuminate\\Database\\Eloquent\\Model->newQuery()
#13 /var/www/server.test/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2346): Illuminate\\Database\\Eloquent\\Model->__call('where', Array)
#48 /var/www/server.test/vendor/laravel/octane/src/ApplicationGateway.php(36): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#49 /var/www/server.test/vendor/laravel/octane/src/Worker.php(84): Laravel\\Octane\\ApplicationGateway->handle(Object(Illuminate\\Http\\Request))
#50 /var/www/server.test/vendor/laravel/octane/bin/frankenphp-worker.php(54): Laravel\\Octane\\Worker->handle(Object(Illuminate\\Http\\Request), Object(Laravel\\Octane\\RequestContext))
#51 [internal function]: {closure}()
#52 /var/www/server.test/vendor/laravel/octane/bin/frankenphp-worker.php(75): frankenphp_handle_request(Object(Closure))
#53 /var/www/server.test/public/frankenphp-worker.php(3): require('/var/www/server...')

Output "php -i | grep mongo":
/etc/php/8.1/cli/conf.d/20-mongodb.ini,
mongodb
libmongoc bundled version => 1.25.2
libmongoc SSL => enabled
libmongoc SSL library => OpenSSL
libmongoc crypto => enabled
libmongoc crypto library => libcrypto
libmongoc crypto system profile => disabled
libmongoc SASL => disabled
libmongoc SRV => enabled
libmongoc compression => enabled
libmongoc compression snappy => disabled
libmongoc compression zlib => enabled
libmongoc compression zstd => disabled
libmongocrypt bundled version => 1.8.2
libmongocrypt crypto => enabled
libmongocrypt crypto library => libcrypto
mongodb.debug => no value => no value

Output "php -m" also contains mongodb

Steps To Reproduce

Installing pure Laravel 10, Octane, as well as the latest version of the mongodb/laravel-mongodb package;
Checking the existence and includes of MongoDB libraries;
Connecting to an existing database, and any access to the database with a MongoDB connection.
Get an error Class "MongoDB\Driver\Manager" not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions