I had PHP5.3 on my ubuntu and is now trying to install PHP5.6 on it.

After purging the current version, This is what I've done first:

  • sudo add-apt-repository ppa:ondrej/php
  • sudo apt-get update
  • sudo apt-get install php5.6

But there are no packages available in that name (checked php-5.6, php56 too, but no luck)

When trying the command

  • apt-get install php5

, it installs PHP, but the older version (5.3)

It appears the packages are not getting fetched from the PPA or something.

Also, I've done an apt-get clean all, and redid the above steps, but still nothing.

Could someone please advise?

closed as off-topic by Gerald Schneider, Jenny D, Ward Feb 26 at 3:04

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions should demonstrate reasonable business information technology management practices. Questions that relate to unsupported hardware or software platforms or unmaintained environments may not be suitable for Server Fault - see the help center." – Gerald Schneider, Jenny D, Ward
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Ubuntu 12.04 is EOL. There will be no more security fixes for your system. Upgrade to a newer version that is still supported and it will be easier to install the newer version of PHP as well. – Gerald Schneider Aug 9 '17 at 12:47

As stated in the other answers, your Ubuntu 12.04 is out of support since April 2017 and the default repositories nor those of Ondrej Sury will work, as he makes clear he doesn't support end of life releases, either of PHP or Ubuntu:

Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.

Ondraj repository supports php 5.6 for Ubuntu 14.04, 16.04, 17.10 and 18.04:

php5.6  5.6.36-1+ubuntu18.04.1+deb.sury.org+1   Ondřej Surý (2018-05-02)
php5.6  5.6.36-1+ubuntu17.10.1+deb.sury.org+1   Ondřej Surý (2018-05-02)
php5.6  5.6.36-1+ubuntu16.04.1+deb.sury.org+1   Ondřej Surý (2018-05-02)
php5.6  5.6.36-1+ubuntu14.04.1+deb.sury.org+1   Ondřej Surý (2018-05-02)

You should upgrade to at least Ubuntu 14.04 Trusty to use his repository and install php 5.6, or upgrade to a later Ubuntu version (16.04 or 18.04) and use php 7 or above.


apt-cache search php will give you a list of packages which are related to PHP. You can find your PHP package over there.

  • done that. seems like there are no packages for the versions above 5.3. It's like the packages from that ppa is not getting fetched. – More_pheus Aug 10 '17 at 8:51

Every Ubuntu main version comes with fixed PHP version.

  • Your Ubuntu 12.04.5 LTS has been EOL since April 28, 2017. It had PHP 5.3.
  • Trusty (14.04 LTS) has PHP 5.5 (until EOL in April 2019). PHP 5.5 itself is not supported.
  • Xenial (16.04 LTS) has PHP 7.0.
  • Artful (17.10) has PHP 7.1.
  • Bionic (18.04 LTS) has PHP 7.2.

If you need another version or multiple (supported) versions of PHP, you can:

  • Compile them by yourself.
  • Add the Personal Package Archive (PPA) repository

    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update

    and use packages maintained by Ondřej Surý, e.g.

    sudo apt-get install php7.2

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