How can I fix: MySQL can't find mysqli.so or xml.so

I bought a new laptop and installed Ubu 20.04. I downloaded the latest apache2, php and mysql

I got phpMyAdmin from their own webpage, because, previously, when I used the Ubuntu supplied version, I often got errors.

When I open: localhost/phpMyAdmin I see a message:

Composer detected issues in your platform. Your Composer dependencies require the following PHP extensions to be installed: mysqli, xml

I cannot run phpMyAdmin.

I tried

pedro@pedro-HP:~$ php -i | grep extension_dir extension_dir => /usr/lib/php/20190902 => /usr/lib/php/20190902 pedro@pedro-HP:~$

I checked /usr/lib/php/20190902, sure enough those two extensions were not there.

Not knowing where to get them, I copied them from my older laptop. I don't know if there is a version problem, but php does not find them.

The new laptop has php version 7.4, the old laptop has 7.2

I set php.ini to:

extension=/usr/lib/php/20190902/mysqli

extension=/usr/lib/php/20190902/xml

I tried with the .so file extension, but saw and error on apache2 error.log: php seems to add .so, so it was looking for mysqli.so.so and xml.so.so

so I removed the .so (no pun intended)

I restarted apache2 and mysql every time I made a change, but the error persists.

sudo /etc/init.d/apache2 restart
sudo /etc/init.d/mysql restart

Now I don't know what else I can do.

Do you have any tips for me? On my old laptop, exactly the same set-up works fine!!

2 Answers

You can install mysqli and xml with below commands

sudo apt-get install php7.x-mysqli
sudo apt-get install php7.x-xml
sudo service apache2 restart

Be sure to replace x with the version you have installed.

eg: sudo apt-get install php7.2-mysqli

1

For mysqli, the following worked for me:

apt install php php-mysqli

The correct version of mysqli was selected based upon the php installed (this was on Ubuntu 20.04.4 LTS).

$ php -m | grep mysqli
$ mysqli

Confirmed that it was now available.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like