M
M
Maxim2021-07-22 17:41:05
PHP
Maxim, 2021-07-22 17:41:05

Why doesn't PHP see the mongodb.so extension (connected in php.ini)?

Hello. Which day is tormented by a problem with the php driver for mongo. Ask for help from experienced people.
The ISPmanager panel is installed, there is a site on Yii2, it is launched on native php 7.4 in FastCGI mode (Nginx + PHP-FPM), the yii2-mongodb package is installed.

Installed the mongodb driver for php:
sudo pecl install mongodb
Displayed the phpinfo() on the site, saw the location of php.ini in the Loaded Configuration File:
/etc/php/7.4/fpm/php.ini
Went to this file, wrote there:
extension=mongodb.so
Trying to access mongo through php and getting an error:
Class MongoDB\Driver\Query not found
And in phpinfo() no mention of mongo at all No, it's like I didn't connect it.

At the same time, if the site is transferred to php in apache module mode, then communication with mongo goes with a bang. Why is this happening? How to make php in FastCGI mode "see" the mongo driver? I even tried to register the connection of this extension in all php.ini - it did not help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shamanov, 2021-07-23
@SilenceOfWinter

1. extensions have not been specified for a long time:
extension=mongodb
2. install composer package composer require mongodb/mongodb
https://docs.mongodb.com/drivers/php/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question