7

I am having trouble enabling mysql in my php-config.

apt-get install php-mysql and apt-get install php7.0-mysql don't make a difference.

Also, the shared object is missing from the php extension directory.

Is there any way I could get the mysql.so?

  • if your using php7, the php7.0-mysql version should be used only. Remove the other and see if it improves. – George Udosen Dec 7 '16 at 20:38
  • In ubuntu 16.10 : /usr/lib/php/20151012/mysqli.so is provided by php7.0-mysql package. Check /etc/php/7.0/apache2/conf.d/20-mysqli.ini, you should have : extension=mysqli.so – f35 Dec 7 '16 at 21:50
9

On Ubuntu, I fixed this error by running

sudo apt-get install php-mysql

And then restarting my server (caddy, apache, nginx).

source

  • Couldn't get this to work on PHP7.1, Ubuntu 16.04 (mysql was still missing) – Nino Škopac Aug 15 '17 at 0:11
  • The error I got, which this information helped me fix: "PHP is missing the MYSQL EXTENSION that WordPress needs". – givonz Nov 7 '17 at 17:20
  • On Ubuntu 16.04 I had to force it to use php7.0-mysql even though I'm actually using php 7.3 (Wordress version 5.2) – Dagmar May 19 at 10:28
4

I'd assume you're talking about the (very) old style MySQL functions in PHP like mysql_connect() or mysql_query(). Those functions have been deprecated for years and years, and have finally been removed in PHP 7. Use the mysqli extension or one of vendor-independent abstraction layers like PDO instead.

0

mysql extension was removed in PHP 7.

You should use mysqli or pdo_mysql instead.

If you still need to use mysql functions (eg. for legacy code support), you may compile the mysql extension manually.

Here's the procedure: https://ckon.wordpress.com/2015/08/06/put-mysql-functions-back-into-php-7/

-3

If I understand correctly, installing LAMP stack should fix your issue. Try this guide

https://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-16-04/

  • Op want's help for mysql not the whole stack – peter Jun 26 '17 at 9:59

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.