Why can't I install php-mysql?
In Windows I use Xampp. I have tried to install MySQL from the command-line and I can access MySQL through workbench software.
Now if I try to run Wordpress on my computer, I get an error that "Your PHP installation appears to be missing the MySQL extension which is required by WordPress."
Someone help me to install MySQL extension(s) for my installation. If I try to install php-mysql:
$ sudo apt-get install php-mysqlthen I get this error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php-mysqlPlease someone help me to install MySQL extension. Most of the blogposts I have seen have this trick, but it's not working for me. The Ubuntu software center shows me that both MySQL server and client are both as installed.
4 Answers
The package is called php5-mysql in Ubuntu, not php-mysql.
Easiest way to install LAMP on Ubuntu is using an APT task:
sudo apt-get install lamp-server^The caret (^) is not a typo.
It will select all the relevant packages for you. For your specific case is Dennis right, you're just missing the PHP5-MySQL bindings which you were installing with the wrong package name. Anyway, the task will make sure you'll have most common packages, including this one.
1If you do not know the exact name of the package you want to install you can run
sudo apt-get update
apt-cache search mysqlThis also holds for other packages than mysql. For instance apt-cache search firefox.
Once the options listed, you can select your choice.
First you check for available versions of software:
sudo apt-cache search php-mysqlThen install the latest version from the list printed out from the previous command:
sudo install php7.4-mysqlIf there was no package, try the following command and redo the above process:
sudo add-apt-repository universe