I've encountered this bug twice now, after upgrading ubuntu in january 2018 (probably to ubuntu 17.10) and when upgrading debian from stretch to buster.
here's what the bug is like. running things like php -m | grep mysqli
shows that
the commandline version of php can find extensions, but doing
print_r(get_loaded_extensions());
in a php file and then viewing it in the browser
shows that the extensions are not loaded in php-fpm/apache.
Here are some things that are suggested on stack overflow and similar sites, but they don't work:
- installing and reinstalling the extensions using the package manager, like
apt install php-mbstring
. - editing config files
(the php-fpm/apache version of
php.ini
which is located at/etc/php/7.3/fpm/php.ini
, not the commandline version ofphp.ini
which is located at/etc/php/7.3/cli/php.ini
) and then restarting nginx/apache/php.
i finally just purged (not just removed) nginx/apache/php and that works. here's the version for nginx:
apt purge nginx* # this will remove all nginx config files! make backups before you run this!
apt purge php*
apt install nginx php7.3 php7.3-fpm php7.3-mysql
apt install php-mbstring php-xml
i'm actually not sure if purging nginx/apache is necessary. you might only need to purge php.
another weird thing: the old version of php (7.0 in my most recent case) is not removed from the system after the upgrade. at first, php-fpm continues to use the old version of php because that's what my nginx config file says. so i manually removed php7.0 and then changed the nginx config files to use php7.3. that's probably a good thing to do, but it doesn't fix the problem.