9

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:

  1. Install php-mysql (It was already the newest version)
  2. Install php7.0-mysql (It was already the newest version)
  3. 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)
  4. 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)
5
  • Please post output of php -r 'phpinfo();' | grep -i pdo. And you should not enable the extensions by hand, but use phpenmod instead. Or rather post full output of phpinfo() somewhere from the same virtual server where you run magento. I suspect you might be doing something to your default php.ini...
    – oerdnj
    Apr 29, 2016 at 10:38
  • Sorry for my late reply. Here is the output: /etc/php/7.0/cli/conf.d/10-pdo.ini, PDO PDO support => enabled PDO drivers => Apr 29, 2016 at 14:16
  • Added the output to initial question as well. Apr 29, 2016 at 14:18
  • And output of: /usr/sbin/phpquery -v 7.0 -M and dpkg -l php*mysql?
    – oerdnj
    Apr 30, 2016 at 20:01
  • Added both the outputs. May 1, 2016 at 4:25

1 Answer 1

8

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 of apt-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.

2
  • I followed the steps of purging, removing directories, reinstalling and also purged php7.0-mysql and installed php-mysql. Now apache itself stopped working, it says unable to handle requests. :( May 1, 2016 at 12:18
  • 1
    sorry my bad, I had to install php7.0-xml, and everything was fine. Thanks a lot. May 1, 2016 at 12:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .