pdo_mysql removed on updating to 16.04

27,914

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.

Share:
27,914

Related videos on Youtube

Rakshith S Kumar
Author by

Rakshith S Kumar

Updated on September 18, 2022

Comments

  • Rakshith S Kumar
    Rakshith S Kumar over 1 year

    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)
    
    • Rakshith S Kumar
      Rakshith S Kumar about 8 years
      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 =>
    • Rakshith S Kumar
      Rakshith S Kumar about 8 years
      Added the output to initial question as well.
    • oerdnj
      oerdnj about 8 years
      And output of: /usr/sbin/phpquery -v 7.0 -M and dpkg -l php*mysql?
    • Rakshith S Kumar
      Rakshith S Kumar about 8 years
      Added both the outputs.
  • Rakshith S Kumar
    Rakshith S Kumar about 8 years
    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. :(
  • Rakshith S Kumar
    Rakshith S Kumar about 8 years
    sorry my bad, I had to install php7.0-xml, and everything was fine. Thanks a lot.