Recently I was doing PHP a project and got some issuse in connecting the MySQL database connection. It was giving my fatal error saying mysqli not found.

My current System Info

Ubuntu 20.04 
PHP 7.4.7
Apache2

How I solved it

After searching for a while I learned that mysqli driver was missing in my system and I have to install the driver. Here's what I did to install the plugin.

Check the php version and install the package mysqli with the bellow command,

Type Ctrl+Alt+T to open the terminal

php -v
sudo apt install php7.4-mysqli
sudo service apache2 restart

This should install the driver and you should be able to connect to the database with the given php script I have shared in the snippet.

To learn more please use the following link to get the detailed information: https://www.php.net/manual/en/mysqli.installation.php