I'm on an Ubuntu 11.10 server with PHP 5.4 installed from a PPA. I had the MySQL library installed (php5-mysql) but wanted to try out the native driver (php5-mysqlnd), so I ran sudo apt-get install php5-mysqlnd
. It caused some errors with dpkg, so I tried to remove it:
$ sudo apt-get remove php5-mysqlnd
Removing php5-mysqlnd ...
dpkg: error processing php5-mysqlnd (--remove):
subprocess installed pre-removal script returned error exit status 1
Processing triggers for libapache2-mod-php5 ...
* Reloading web server config apache2
Errors were encountered while processing:
php5-mysqlnd
When I first installed php5-mysqlnd, it uninstalled php5-mysql--and now I can't reinstall that, as it tries to remove php5-mysqlnd. Now I'm left without a way to connect to my MySQL server in PHP.
How can I fix this problem? I've tried forcefully removing php5-mysqlnd (as per php5-mysqlnd on debian wheezy/sid?), but that gives the same exact error.
sudo rm /var/lib/dpkg/info/php5-mysqlnd.prerm
This allowed me to install php5-mysql again. Modified from How to fix broken synaptic updates