Debian: pdo_mysql.so: undefined symbol: pdo_parse_params in Unknown on line 0

root's picture

You are here because you got this error when trying to run php via command line:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/pdo_mysql.so' - /usr/lib/php5/20100525/pdo_mysql.so: undefined symbol: pdo_parse_params in Unknown on line 0

Also, you probably use Debian Squeeze and you recently did software update.
If yes, read on for a fix.

1. The error:

root@jupiter:~# php -v
[color=red]PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/pdo_mysql.so' - /usr/lib/php5/20100525/pdo_mysql.so: undefined symbol: pdo_parse_params in Unknown on line 0[/color]
PHP 5.4.41-0+deb7u1 (cli) (built: May 22 2015 12:49:18)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
    with XCache v2.0.0, Copyright (c) 2005-2012, by mOo

2. The solution: remove and purge the php5-common package. Be aware that other packages will be removed too and you will have to accept the action. Write them down as you will need them on step 3.

WARNING: this will remove all configuration files so if you have some highly custom ones, please back them up before running this command. You can put them back afterwards if needed.
apt-get --purge remove php5-common

3. Install back all packages removed with the previous command:
apt-get install php5-common etc.

4. Check again php command, you should be fine:

root@jupiter:~# php -v
PHP 5.4.41-0+deb7u1 (cli) (built: May 22 2015 12:49:18)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
    with XCache v2.0.0, Copyright (c) 2005-2012, by mOo
Example:
root@jupiter:~# [color=green]apt-get --purge remove php5-common[/color]
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libc-client2007e libmcrypt4 libonig2 libqdbm14 mlock
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  libapache2-mod-php5* libphp-adodb* php-auth-sasl* php-net-smtp* php-net-socket* php-pear* php5* php5-cgi* php5-cli* php5-common* php5-curl* php5-ffmpeg* php5-gd* php5-geoip* php5-imap*
  php5-mcrypt* php5-memcache* php5-mysql* php5-pspell* php5-xcache*
0 upgraded, 0 newly installed, 20 to remove and 0 not upgraded.
After this operation, 41.7 MB disk space will be freed.
Do you want to continue [Y/n]?
(Reading database ... 60054 files and directories currently installed.)
Removing libphp-adodb ...
Purging configuration files for libphp-adodb ...
Removing php5 ...
Removing libapache2-mod-php5 ...
Module php5 disabled.
To activate the new configuration, you need to run:
  service apache2 restart
Purging configuration files for libapache2-mod-php5 ...
dpkg: warning: while removing libapache2-mod-php5, directory '/etc/php5/apache2' not empty so not removed
Removing php-auth-sasl ...
Removing php-net-smtp ...
Removing php-net-socket ...
Removing php-pear ...
Purging configuration files for php-pear ...
Removing php5-cgi ...
ERROR: Module php5_cgi does not exist!
Purging configuration files for php5-cgi ...
dpkg: warning: while removing php5-cgi, directory '/etc/php5/cgi' not empty so not removed
Removing php5-pspell ...
WARNING: pspell module does not exist!
Purging configuration files for php5-pspell ...
Removing php5-mysql ...
Purging configuration files for php5-mysql ...
Removing php5-mcrypt ...
WARNING: mcrypt module does not exist!
Purging configuration files for php5-mcrypt ...
Removing php5-imap ...
WARNING: imap module does not exist!
Purging configuration files for php5-imap ...
Removing php5-gd ...
WARNING: gd module does not exist!
Purging configuration files for php5-gd ...
Removing php5-curl ...
WARNING: curl module does not exist!
Purging configuration files for php5-curl ...
Removing php5-xcache ...
WARNING: xcache module does not exist!
Purging configuration files for php5-xcache ...
Removing php5-memcache ...
WARNING: memcache module does not exist!
Purging configuration files for php5-memcache ...
Removing php5-geoip ...
Purging configuration files for php5-geoip ...
Removing php5-ffmpeg ...
WARNING: ffmpeg module does not exist!
Purging configuration files for php5-ffmpeg ...
Removing php5-cli ...
Purging configuration files for php5-cli ...
Removing php5-common ...
WARNING: pdo module does not exist!
Purging configuration files for php5-common ...
dpkg: warning: while removing php5-common, directory '/etc/php5/conf.d' not empty so not removed
Processing triggers for man-db ...
root@jupiter:~# [color=green]apt-get install libapache2-mod-php5 libphp-adodb php-auth-sasl php-net-smtp php-net-socket php-pear php5 php5-cgi php5-cli php5-common php5-curl php5-ffmpeg php5-gd php5-geoip php5-imap php5-mcrypt php5-memcache php5-mysql php5-pspell php5-xcache libc-client2007e libmcrypt4 libonig2 libqdbm14 mlock[/color]
Reading package lists... Done
Building dependency tree
Reading state information... Done
libmcrypt4 is already the newest version.
libmcrypt4 set to manually installed.
libonig2 is already the newest version.
libonig2 set to manually installed.
libqdbm14 is already the newest version.
libqdbm14 set to manually installed.
libc-client2007e is already the newest version.
libc-client2007e set to manually installed.
mlock is already the newest version.
mlock set to manually installed.
Suggested packages:
  php5-adodb php5-dev
The following NEW packages will be installed:
  libapache2-mod-php5 libphp-adodb php-auth-sasl php-net-smtp php-net-socket php-pear php5 php5-cgi php5-cli php5-common php5-curl php5-ffmpeg php5-gd php5-geoip php5-imap php5-mcrypt
  php5-memcache php5-mysql php5-pspell php5-xcache
0 upgraded, 20 newly installed, 0 to remove and 0 not upgraded.
Need to get 804 kB/12.5 MB of archives.
After this operation, 41.7 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.us.debian.org/debian/ wheezy/main php-net-socket all 1.0.9-2 [9,068 B]
Get:2 http://ftp.us.debian.org/debian/ wheezy/main php-net-smtp all 1.6.1-1 [22.7 kB]
Get:3 http://ftp.us.debian.org/debian/ wheezy/main php5-xcache amd64 2.0.0-4 [112 kB]
Get:4 http://ftp.us.debian.org/debian/ wheezy/main libphp-adodb all 5.15-1 [567 kB]
Get:5 http://ftp.us.debian.org/debian/ wheezy/main php-auth-sasl all 1.0.4-1 [9,530 B]
Get:6 http://ftp.us.debian.org/debian/ wheezy/main php5-ffmpeg amd64 0.6.0-2.2 [23.9 kB]
Get:7 http://ftp.us.debian.org/debian/ wheezy/main php5-memcache amd64 3.0.6-6 [60.6 kB]
Fetched 804 kB in 2s (295 kB/s)
Preconfiguring packages ...
Selecting previously unselected package php5-common.
(Reading database ... 59432 files and directories currently installed.)
Unpacking php5-common (from .../php5-common_5.4.41-0+deb7u1_amd64.deb) ...
Selecting previously unselected package php5-cli.
Unpacking php5-cli (from .../php5-cli_5.4.41-0+deb7u1_amd64.deb) ...
Selecting previously unselected package php-pear.
Unpacking php-pear (from .../php-pear_5.4.41-0+deb7u1_all.deb) ...
Selecting previously unselected package php-net-socket.
Unpacking php-net-socket (from .../php-net-socket_1.0.9-2_all.deb) ...
Processing triggers for man-db ...
Setting up php5-common (5.4.41-0+deb7u1) ...

Creating config file /etc/php5/mods-available/pdo.ini with new version
Setting up php5-cli (5.4.41-0+deb7u1) ...

Creating config file /etc/php5/cli/php.ini with new version
update-alternatives: using /usr/bin/php5 to provide /usr/bin/php (php) in auto mode
Setting up php-pear (5.4.41-0+deb7u1) ...
Selecting previously unselected package php-net-smtp.
(Reading database ... 59677 files and directories currently installed.)
Unpacking php-net-smtp (from .../php-net-smtp_1.6.1-1_all.deb) ...
Selecting previously unselected package php5-cgi.
Unpacking php5-cgi (from .../php5-cgi_5.4.41-0+deb7u1_amd64.deb) ...
Selecting previously unselected package libapache2-mod-php5.
Unpacking libapache2-mod-php5 (from .../libapache2-mod-php5_5.4.41-0+deb7u1_amd64.deb) ...
Selecting previously unselected package php5-curl.
Unpacking php5-curl (from .../php5-curl_5.4.41-0+deb7u1_amd64.deb) ...
Selecting previously unselected package php5-gd.
Unpacking php5-gd (from .../php5-gd_5.4.41-0+deb7u1_amd64.deb) ...
Selecting previously unselected package php5-imap.
Unpacking php5-imap (from .../php5-imap_5.4.41-0+deb7u1_amd64.deb) ...
Selecting previously unselected package php5-mcrypt.
Unpacking php5-mcrypt (from .../php5-mcrypt_5.4.41-0+deb7u1_amd64.deb) ...
Selecting previously unselected package php5-mysql.
Unpacking php5-mysql (from .../php5-mysql_5.4.41-0+deb7u1_amd64.deb) ...
Selecting previously unselected package php5-pspell.
Unpacking php5-pspell (from .../php5-pspell_5.4.41-0+deb7u1_amd64.deb) ...
Selecting previously unselected package php5-xcache.
Unpacking php5-xcache (from .../php5-xcache_2.0.0-4_amd64.deb) ...
Selecting previously unselected package php5.
Unpacking php5 (from .../php5_5.4.41-0+deb7u1_all.deb) ...
Selecting previously unselected package libphp-adodb.
Unpacking libphp-adodb (from .../libphp-adodb_5.15-1_all.deb) ...
Selecting previously unselected package php-auth-sasl.
Unpacking php-auth-sasl (from .../php-auth-sasl_1.0.4-1_all.deb) ...
Selecting previously unselected package php5-ffmpeg.
Unpacking php5-ffmpeg (from .../php5-ffmpeg_0.6.0-2.2_amd64.deb) ...
Selecting previously unselected package php5-geoip.
Unpacking php5-geoip (from .../php5-geoip_1.0.7-8_amd64.deb) ...
Selecting previously unselected package php5-memcache.
Unpacking php5-memcache (from .../php5-memcache_3.0.6-6_amd64.deb) ...
Processing triggers for man-db ...
Setting up php-net-socket (1.0.9-2) ...
Setting up php-net-smtp (1.6.1-1) ...
Setting up php5-cgi (5.4.41-0+deb7u1) ...

Creating config file /etc/php5/cgi/php.ini with new version
update-alternatives: using /usr/bin/php5-cgi to provide /usr/bin/php-cgi (php-cgi) in auto mode
update-alternatives: using /usr/lib/cgi-bin/php5 to provide /usr/lib/cgi-bin/php (php-cgi-bin) in auto mode
Setting up libapache2-mod-php5 (5.4.41-0+deb7u1) ...

Creating config file /etc/php5/apache2/php.ini with new version
[ ok ] Restarting web server: apache2.
Setting up php5-curl (5.4.41-0+deb7u1) ...

Creating config file /etc/php5/mods-available/curl.ini with new version
Setting up php5-gd (5.4.41-0+deb7u1) ...

Creating config file /etc/php5/mods-available/gd.ini with new version
Setting up php5-imap (5.4.41-0+deb7u1) ...

Creating config file /etc/php5/mods-available/imap.ini with new version
Setting up php5-mcrypt (5.4.41-0+deb7u1) ...

Creating config file /etc/php5/mods-available/mcrypt.ini with new version
Setting up php5-mysql (5.4.41-0+deb7u1) ...

Creating config file /etc/php5/mods-available/mysql.ini with new version

Creating config file /etc/php5/mods-available/mysqli.ini with new version

Creating config file /etc/php5/mods-available/pdo_mysql.ini with new version
Setting up php5-pspell (5.4.41-0+deb7u1) ...

Creating config file /etc/php5/mods-available/pspell.ini with new version
Setting up php5-xcache (2.0.0-4) ...
Setting up php5 (5.4.41-0+deb7u1) ...
Setting up libphp-adodb (5.15-1) ...
Setting up php-auth-sasl (1.0.4-1) ...
Setting up php5-ffmpeg (0.6.0-2.2) ...
Setting up php5-geoip (1.0.7-8) ...
Setting up php5-memcache (3.0.6-6) ...
Processing triggers for libapache2-mod-php5 ...
[ ok ] Reloading web server config: apache2.

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.