mongodb / mongo-php-driver

The Official MongoDB PHP driver
https://pecl.php.net/package/mongodb
Apache License 2.0
886 stars 201 forks source link

PHP Warning: PHP Startup: Unable to load dynamic library 'mongodb.so' #1505

Open thangbv opened 9 months ago

thangbv commented 9 months ago

I installed on Centos 7 with PHP 7.4. MongoDB server is 7.0.4. But when starting nginx, I receive a warning: PHP Startup: Unable to load dynamic library 'mongodb.so' (tried: /usr/lib64/php/modules/mongodb.so (/usr/lib64/php/modules/mongodb.so: undefined symbol: BIO_meth_set_read), /usr /lib64/php/modules/mongodb.so.so (/usr/lib64/php/modules/mongodb.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0. Also in php.ini don't see mongodb extension

GromNaN commented 9 months ago

How did you install the mongodb php extension? Do you have the same PHP version running on the cli and php-fpm? Did you restart php-fpm after installing the mongodb extension?

cloud-chang commented 9 months ago

@GromNaN same question

php8.2 ,ubuntu 22 :

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20210902/mongodb.so' (tried: /usr/lib/php/20210902/mongodb.so (/usr/lib/php/20210902/mongodb.so: undefined symbol: executor_globals), /home/vscode/software/php/lib/php/extensions/no-debug-zts-20220829//usr/lib/php/20210902/mongodb.so.so (/home/vscode/software/php/lib/php/extensions/no-debug-zts-20220829//usr/lib/php/20210902/mongodb.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

install php

#!/bin/bash
sudo apt update
sudo DEBIAN_FRONTEND=noninteractive apt install -y autoconf libpng-dev libjpeg-dev git libsystemd-dev build-essential g++ libcurl4-openssl-dev libssl-dev gcc wget pkg-config curl  libxml2 libxml2-dev libzip-dev libonig-dev librust-onig-dev sqlite3 libsqlite3-dev

PREFIX_DIR=$HOME/software/php
./configure --prefix=$PREFIX_DIR --with-fpm-systemd --enable-fpm  --with-curl --enable-mysqlnd --with-zip --with-config-file-path=${PREFIX_DIR}/config --with-config-file-scan-dir=${PREFIX_DIR}/config  --enable-sockets  --with-pdo-mysql  --enable-pcntl   --enable-mbstring  --enable-intl --enable-zts --with-zlib --enable-bcmath --enable-bcmath --with-openssl --enable-gd --with-jpeg; 
make -j4 && make install
echo export PATH=$HOME/software/php/bin:$PATH>>~/.bashrc;
source ~/.bashrc;

install mongodb

sudo pecl install mongodb

Do you have the same PHP version running on the cli and php-fpm?

no

Did you restart php-fpm after installing the mongodb extension?

yes, still not work