Sunday, December 13, 2015

apt - libapache2-mod-php5 : Depends: php5-common


I installed php5.5 and upgrade Ubuntu from 12 to 14. Now the system isn't working.
I did


sudo apt-get upgrade && sudo apt-get install libapache2-mod-php5

But got


The following packages have unmet dependencies:
libapache2-mod-php5 : Depends: php5-common (= 5.5.9+dfsg-1ubuntu4.4) but 5.5.18+dfsg-1+deb.sury.org~precise+1 is to be installed
E: Unable to correct problems, you have held broken packages.

How do I resolve it?


The commands I used to install php5.5 were like:


add-apt-repository ppa:ondrej/php5-oldstable
apt-get install ppa:ondrej/php5-oldstable
apt-get update
apt-get install php5
apt-get install python-software-properties
add-apt-repository ppa:ondrej/php5
apt-get update
apt-get install php5-common php5-mysql php5-xmlrpc php5-cgi php5-curl php5-gd php5-cli php5-fpm php-apc php-pear php5-dev php5-imap php5-mcrypt


Your problem is that you have an unofficial PPA which is breaking your install procedure. To remediate this, run the below commands:


sudo add-apt-repository --remove ppa:ondrej/php5-oldstable
sudo add-apt-repository --remove ppa:ondrej/php5

This PPA is providing a different (old) version of PHP instead of the proper version that Ubuntu wants.


Run these commands to add the extra repositories:


sudo add-apt-repository universe
sudo add-apt-repository multiverse

Now, run:


sudo apt-get update

Your repository information will be the official Ubuntu ones. Install libapache2-mod-php5 using this command:


sudo apt-get install libapache2-mod-php5

Note: You may need to uninstall the old PHP packages first. Command:


sudo apt-get remove php5 php5-common php5-mysql php5-xmlrpc php5-cgi php5-curl php5-gd php5-cli php5-fpm php-apc php-pear php5-dev php5-imap php5-mcrypt



You should not add PPAs unless you absolutely need them. They can break more than they solve and can cause problems like this. Also, unofficial PPAs are attack vectors for potential viruses. Unless you really need to use a PPA, don't.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...