Error in phpmyadmin - `mysqli extension is missing`

Rayon Nunes picture Rayon Nunes · Dec 24, 2018 · Viewed 13.7k times · Source

I`ve just installed LAMP stack (also tried with nginx) and after installing the phpmyadmin and trying to access 'localhost/phpmyadmin', I receive this message:

The mysqli extension is missing. Please check your PHP configuration

I already have tried the steps from here and also from here.

I tried to install on Ubuntu 18.04 'php7.2-mysql' (php 7.2 is my current version of php) and 'php7.2-mysqli' redirects to 'php7.2-mysql' and both of them are already installed at its newest version.

In the phpmyadmin documentation, here's what it is saying about the missing extension:

1.20 I receive an error about missing mysqli and mysql extensions.

To connect to a MySQL server, PHP needs a set of MySQL functions called >“MySQL extension”. This extension may be part of the PHP distribution >(compiled-in), otherwise it needs to be loaded dynamically. Its name is >probably mysqli.so or php_mysqli.dll. phpMyAdmin tried to load the >extension but failed. Usually, the problem is solved by installing a >software package called “PHP-MySQL” or something similar.

There are currently two interfaces PHP provides as MySQL extensions - mysql >and mysqli. The mysqli is tried first, because it’s the best one.

Also I have already tried to modify the php.ini file adding or uncommenting these following lines:

extension=mysqli
extension=mysqli.so
extension=mysqli.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo_mysql.dll

and then tried to reinstall the phpmyadmin with and without configuring a database by dbconfig-common. also reinstalled mysql-server (version 5.7.24) with and without secure_installation.

With apache2 i've installed the following php packages:

php php-cgi libapache2-mod-php php-common php-pear php-mbstring

With nginx i've installed the following php packages:

php-fpm php-mysql

but none of this even changed the error message (even after purging packages and manually removing folders and reinstalling).

Important to note that all the programs in stack works fine. making me think that is some issue with phpmyadmin.

So, I wanted enter to the login screen of phpmyadmin, but nothing seems to work. already tried several solutions, several times. if someone could help me with this, please answer! thanks.

Answer

Calos picture Calos · Dec 24, 2018

If you change some configuration and haven't remove it in reinstall, then didn't help. Follow this command to clear old configs:

sudo apt purge php7.2-* phpmyadmin

After removed, reinstall packages:

sudo apt install apache2 php7.2 php7.2-mysql # Add other dependent if you need ...

Now, mysqli should exists in /etc/php/7.2/mods-available/20-mysqli.ini:

$ cat /etc/php/7.2/mods-available/mysqli.ini
; configuration for php mysql module
; priority=20
extension=mysqli.so

If you using FPM, should have a soft link in /etc/php/7.2/fpm/conf.d/20-mysqli.ini