0

Getting error when installing php5-mysql. Looks like a dpkg error. Perhaps a broken package.

Have tried to fix the broken package. Have reinstalled the lamp server and everything seems fine except being able to install the php5-mysql extension, I get:

Errors were encountered while processing: php5-mysql  

The sub-process for dpkg is returning an error code.

Any ideas appreciated.

2
  • 2
    Please give us the complete error. Nov 13, 2012 at 0:20
  • 1
    Please give us a more comprehensive log of the error.
    – owl
    Nov 13, 2012 at 5:25

2 Answers 2

1

This technique is based on owl's answer, but:

  • It avoids deleting the .prerm file. This file is needed to ensure the package is uninstalled cleanly, and removing it could potentially leave traces of the package remaining, leave the system configured in a way that expects the package to be installed, or leave services provided by the package running, even once the files are removed.

    That makes this technique safer, though potentially it might not work if there is also a problem running the .prerm script. (This may have been why owl said to delete it.) Fortunately, usually the .prerm script does not fail.

  • This technique potentially removes more configuration files, so depending on the cause of the problem, this might be more effective.

    It also makes sure we are fetching the correct version of the package to install.

Run:

sudo dpkg -P php5-mysql
sudo apt-get --purge autoremove
sudo apt-get update
sudo apt-get install php5-mysql

If there are no errors, then everything is cleaned up from the previous installation and php5-mysql is installed. In that case, the package should work properly now.

-1

Why don't you try this command:

sudo rm /var/lib/dpkg/info/php5-mysqlnd.prerm

Or

sudo apt-get autoremove php5-mysql 

This allowed me to install php5-mysql again.

So install php5-mysql again:

sudo apt-get install php5-mysql
4
  • This is really not a good idea. Nov 13, 2012 at 0:29
  • Why not? I think it works for me.
    – owl
    Nov 13, 2012 at 0:30
  • Thanks for the reply. I ended up deleting all the package files relative to mysql and was able to reinstall.
    – Daryl Wood
    Nov 19, 2012 at 2:59
  • 1
    @DarylWood In that case, you should mark this as the accepted answer, by clicking the gray check mark to the left of it. Dec 26, 2012 at 10:05

You must log in to answer this question.

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