I am trying to install php 5.4 in ubuntu 12.10 but its not working. I keep getting php5 is already the newest version. (5.3.10).

I tried to add the ondrej/php5-oldstable but still, it wont do the upgrade.

I have done sudo apt-get-update && sudo apt-get dist-upgrade.

This is the result of

 apt-cache policy php5

  Installed: 5.3.10-1ubuntu3
  Candidate: 5.3.10-1ubuntu3
  Package pin: 5.3.10-1ubuntu3
  Version table:
     5.4.6-1ubuntu1.7 991
        500 http://pt.archive.ubuntu.com/ubuntu/ quantal-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ quantal-security/main amd64 Packages
     5.4.6-1ubuntu1 991
        500 http://pt.archive.ubuntu.com/ubuntu/ quantal/main amd64 Packages
     5.3.10-1ubuntu3.10 991
        500 http://bg.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
 *** 5.3.10-1ubuntu3 991
        500 http://bg.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status

As you can see I can see the latest php 5.4 in Version Table but cant upgrade.


The output of apt-cache policy php5 clearly shows that the package php5 was pinned to a specific version.

  Installed: 5.3.10-1ubuntu3
  Candidate: 5.3.10-1ubuntu3
  Package pin: 5.3.10-1ubuntu3

You have to unpin the package, so that it would be upgradeable.

Run the below command to unpin the php5 package,

sudo apt-mark unhold php5

Then try to update that package,

sudo apt-get install php5

Ok. I solved the problem. Their was a policy file in /etc/apt/preferences.d that was blocking the update.

  • 1
    How did you know this? – Avinash Raj Apr 1 '14 at 14:51
  • Yes, the package pin.I failed to see that in the output of apt-cache policy php5 command. – Avinash Raj Apr 1 '14 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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