Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to install php5-mysqlnd on a fresh install of Wheezy (/etc/debian_version refers to it as wheezy/sid) and I'm having a problem:

root@debian:/var/www/lottery1# apt-get install php5-mysqlnd
Reading package lists... Done
Building dependency tree       
Reading state information... Done
php5-mysqlnd is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? Y
Setting up php5-mysqlnd (5.4.0-3) ...
ucfr: Attempt from package php5-mysqlnd  to take /etc/php5/mods-available/mysql.ini away from package php5-mysql
ucfr: Aborting.
dpkg: error processing php5-mysqlnd (--configure):
 subprocess installed post-installation script returned error exit status 4
Processing triggers for libapache2-mod-php5 ...
configured to not write apport reports
                                      Reloading web server config: apache2.
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

It seems there is some sort of conflict with the php5-mysql package, but I still get this error even after removing (with --purge) the php5-mysql package.

Any thoughts? I'm trying to run a web tool that makes heavy use of mysqli_result::fetch_all().


share|improve this question
up vote 1 down vote accepted

So after removing php5-mysql, I had to forcefully remove php5-mysqlnd, then I had to purge php5-mysql, then I had to purge php5-mysqlnd, then I could install php5-mysqlnd.

dpkg --remove --force-remove-reinstreq php5-mysqlnd
dpkg --purge php5-mysql 
dpkg --purge php5-mysqlnd 

Only once dpkg -l | grep php5-mysql had no output, could I apt-get install php5-mysqlnd and have it work.

share|improve this answer
I was having similar errors, and had to to remove php5-fpm package before running your instructions, must have been some kind of conflict. – littleguy Jul 5 '12 at 12:31
I was having similar errors after upgrading php on the server: The following packages have unmet dependencies: php5-mysql : Conflicts: php5-mysqlnd but is to be installed php5-mysqlnd : Conflicts: php5-mysql but is to be installed E: Unable to correct problems, you have held broken packages. So I remove both packages & reinstalled them - that solved it for me. – Jadeye May 8 '15 at 12:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.