-1

I am trying to add MySql support in PHP. I am using PHP version 7.2.11. When i'm trying to run my application, it shows the following error:

Your PHP installation does not have MySQL support. Please enable MySQL support in PHP or ask your web host to do so for you.

This problem didn't occur when i tried with older versions of PHP. Any help would be appreciated.

Shadow
  • 33,525
  • 10
  • 51
  • 64
imtiaz rupu
  • 1
  • 1
  • 5
  • Possible duplicate of [How to enable MySQLi extension in php 7?](https://stackoverflow.com/questions/35424982/how-to-enable-mysqli-extension-in-php-7) – Roshan Mar 06 '19 at 08:33
  • Is there any solution without converting to MySQLi – imtiaz rupu Mar 06 '19 at 08:50
  • 1
    No, `MySQL` is deprecated on `PHPv5.5.0` up to now. Some reasons why you would never `mysql` you can see [here](https://stackoverflow.com/questions/548986/mysql-vs-mysqli-when-using-php) – Roshan Mar 06 '19 at 08:58
  • Possible duplicate of [Fatal error: Uncaught Error: Call to undefined function mysql\_connect()](https://stackoverflow.com/questions/34579099/fatal-error-uncaught-error-call-to-undefined-function-mysql-connect) – Shadow Mar 06 '19 at 10:44
  • 1
    @imtiazrupu yes, there is another solution: convert to PDO :) The mysql extension has been removed from php 7. Period. You really should move away from that extension. If you insist on using it, then you need to downgrade your php version. – Shadow Mar 06 '19 at 10:46

1 Answers1

0

1- Update the required packages If your are running an Ubuntu VPS and PHP 7, then run the following commands:

apt-get update
apt-get install php7.0-mysql

if you are running a CentOS VPS and you have PHP 7, then run the following commands to fix the problem:

yum update
yum install php70w-mysql

2- Restart the Web Server,

If your are running an Ubuntu, then run the following commands:

sudo service apache2 reload

If your are running an CentOS, then run the following commands:

sudo systemctl reload httpd.service
Naveed Ramzan
  • 3,565
  • 3
  • 25
  • 30