0

I encountered some problem while I was trying to upgrade my php5.3 to php5.4 or higher version.

Here's the command I typed apt-get -f install php5.5

And came out of this:

You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-generic : Depends: linux-image-generic (= 3.2.0.116.132) but 3.2.0.124.139 is to be installed
                 Depends: linux-headers-generic (= 3.2.0.116.132) but 3.2.0.124.139 is to be installed
 php-amqp : Depends: php-common (>= 1:7.0+33~) but it is not going to be installed
            Depends: phpapi-20160303 or
                     phpapi-20151012 or
                     phpapi-20131226 or
                     phpapi-20121212 but it is not installable
            Depends: librabbitmq4 (>= 0.6.0) but it is not going to be installed
 php-gearman : Depends: php-common (>= 1:7.0+33~) but it is not going to be installed
               Depends: phpapi-20160303 or
                        phpapi-20151012 or
                        phpapi-20131226 or
                        phpapi-20121212 but it is not installable
               Depends: libgearman8 (>= 1.1.13) but it is not going to be installed
 php-geoip : Depends: php-common (>= 1:7.0+33~) but it is not going to be installed

The rest is pretty much the same labeled with it is not going to be installed

My OS is Ubuntu 12.04.5 LTS.

It looks like the linux-image-generic and linux-headers-generic aren't matched to the one in need.

So the upgrade wasn't success and I was still stuck on php5.3.10.

I tried dpkg --purge linux-image-generic and dpkg --purge linux-headers-generic but still get the same error.

And dpkg --configure -a is also a no go.

Thoughts on this?

UPDATE:

After I followed Arijit's solution and typed apt-get install php5

Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-generic : Depends: linux-image-generic (= 3.2.0.116.132) but 3.2.0.124.139 is to be installed
                 Depends: linux-headers-generic (= 3.2.0.116.132) but 3.2.0.124.139 is to be installed
 php5 : Depends: libapache2-mod-php5 (>= 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1) but 5.3.10-1ubuntu3.26 is to be installed or
                 libapache2-mod-php5filter (>= 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1) but it is not going to be installed or
                 php5-cgi (>= 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1) but it is not going to be installed or
                 php5-fpm (>= 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1) but it is not going to be installed
        Depends: php5-common (>= 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1) but 5.3.10-1ubuntu3.26 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

The version is still php5.3. And the python properties is the latest version.

This is the checks of the php5 versions. Tried apt-get install php5.4.45, couldn't be installed.

php5:
  Installed: (none)
  Candidate: 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1
  Version table:
     5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1 0
        500 http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/ precise/main amd64 Packages
     5.3.10-1ubuntu3.26 0
        500 http://archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
     5.3.10-1ubuntu3 0
        500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

UPDATE2:

After I dug a little more about the situation, I found solution here. Broken count error : linux-generic-pae : Depends: linux-image-generic-pae (= 3.2.0.37.44) but 3.2.0.37.45 is installed

And the solution for my specific problem is the comment left by @Simon

Had the same problem but with linux-generic package depending on a specific version of linux-image-generic and linux-headers-generic, but a newer version to be installed caused 'Unmet dependencies' error. Solved it with sudo dpkg --remove linux-generic && sudo apt-get install linux-generic. Thanks!

So the solution is pretty simple,

  1. sudo dpkg --remove linux-generic
  2. sudo apt-get linux-generic
  3. Repeat the procedure of installing the php.

    • LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php

    • apt-get update

    • apt-get install php5.6 or php7

  4. Noted that don't use Deprecated version of the PPA, please use LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php to get the latest version of safe and stable php.

  5. apt-get install php5.6 or php7. php5.4 and lower are not supported anymore in 2015.
  6. There you have it, now you have successfully installed php5.6 and higher version. If not then restart your service. sudo service apache2 restart and sudo service nginx restart
3
  • Post the solution in an answer instead of in the question, please
    – muru
    Mar 10, 2017 at 7:15
  • Like I answer to my own question? Mar 10, 2017 at 7:16
  • 1
    yes, answering your own question is fine
    – muru
    Mar 10, 2017 at 7:16

1 Answer 1

0

Please follow me here:

  1. You have to update first and install Python Software Properties sudo apt-get update && sudo apt-get install python-software-properties
  2. Now Add a PPA sudo add-apt-repository ppa:ondrej/php
  3. Now update again sudo apt-get update
  4. Check the available php5 version apt-cache policy php5
  5. Now install php5.x sudo apt-get install php5.4
  6. Check the php version now php5 -v, if not php5.4, then restart Apache sudo /etc/init.d/apache2 restart or sudo service apache2 restart

Hope it will be solved

6
  • Unfortunately it didn't work Arijit, but still thank you. I updated my post, there's what happened after I follow the instruction. Mar 9, 2017 at 9:54
  • Okay, sorry for that, will try to come up with a solution soon. Thanks Mar 9, 2017 at 11:22
  • @EugeneRider: Just check with the PPA, seems the PPA name has changed. Updated my response with the new PPA. You may try it. Mar 9, 2017 at 11:27
  • um... still didn't work. After step 5, there's E: couldn't find pakage php5.4 error. If you type php5, it's the same problem with the linux generic. Mar 9, 2017 at 12:28
  • Okay :(, anyway, will check further. Mar 9, 2017 at 12:30

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