I recently updated to 16.04 LTS. And it updated my php to 7.0. Now it some how removed pdo_mysql. I need this extension to develop magento website. In phpinfo, I find
pdo support: enabled
pdo drivers: no values
I have googled a lot, and found these solutions:
- Install php-mysql (It was already the newest version)
- Install php7.0-mysql (It was already the newest version)
- Changed following in php.ini (/etc/php/7.0/apache2/php.ini): enabled extensions pdo.so, pdo_mysql.so, mysqli.so. and also tried the same by giving their exact paths(restarted apache after making changes)
- Even tried installing pdo_mysql using pecl.
None of the above methods were helpful, I have been breaking my head on this for almost 2 days now. Help would be highly appreciated.
Output of php -r 'phpinfo();' | grep -i pdo :
/etc/php/7.0/cli/conf.d/10-pdo.ini,
PDO
PDO support => enabled
PDO drivers =>
output of /usr/sbin/phpquery -v 7.0 -M
mysqlnd
sysvmsg
sockets
gd
mcrypt
phar
xsl
xmlreader
shmop
sysvsem
mysqli
xml
tokenizer
iconv
pdo
pdo_mysql
gettext
simplexml
xmlwriter
opcache
posix
sysvshm
ftp
dom
json
readline
calendar
fileinfo
ctype
wddx
exif
output of dpkg -l php*mysql
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii php-mysql 1:7.0+35ubun all MySQL module for PHP [default]
un php-pdo-mysql <none> <none> (no description available)
rc php5-mysql 5.6.11+dfsg- amd64 MySQL module for php5
ii php7.0-mysql 7.0.4-7ubunt amd64 MySQL module for PHP
un php7.0-pdo-mys <none> <none> (no description available)
Best Answer
At this stage I would simply recommend "turning it off and on again" by doing:
sudo apt-get purge php-common php5-common
followed by
sudo rm -r /etc/php
And then reinstalling PHP 7.0 and mysql modules:
sudo apt-get install libapache2-mod-php php-mysql
You may also try just purging and reinstalling mysql modules, first removing the package:
sudo apt-get purge php7.0-mysql
And the installing them again:
sudo apt-get install php-mysql
In both cases it's important to use
apt-get purge
instead ofapt-get remove
to delete any existing configuration files and package states.The least destructive way would be trying to re-enable mysql modules using
phpenmod
command:sudo phpenmod mysqlnd pdo_mysql
It's hard to give you correct advice if we don't know what mayhem you created on your system.