Error “Your php installation appears to be missing the mysql extension which is required by wordpress” on Ubuntu 18.0.4. and PHP 7.2

Solution:1

1.First check which version install in your pc by using this command :

php  -v

2.for example if you getting 7.2 run like this (based on php version )

sudo apt-get install php7.2-common php7.2-mysql

3.After install MySql restart apache server

sudo service apache2 restart

Solution:2

I am adding my answer here – though the circumstances are slightly different. I upgraded my Debian installation – and in the process php was upgraded from php 5 to php 7.0

It turns out that apache2 was still loading the php5 module and not the php7.0 module.

I needed to run the below:

  sudo a2dismod php5
  sudo a2enmod php7.0
  sudo systemctl restart apache2

Subsequently, my web pages loaded up.

Solution:3

i solved this type of error in my .htaccess using the below code on a shared server that uses cpanel

# END WordPress
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php71” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php71 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

Solution:4

A combination of the solutions above helped me.

After updating I couldn’t reach my sites anymore, so I altered the code like this:

sudo a2dismod php*
sudo a2enmod php8.0
sudo systemctl restart apache2