Logo
  • PHP
    • HipHop / HHVM
    • Modern PHP
    • PHPStorm
    • LAMP
    • Laravel
    • Composer
    • PDO
  • JavaScript
    • node.js
    • AngularJS
  • CSS
    • SASS
    • “CSS4” (CSS level 4)
  • HTML
  • Git
  • LAMP
  • Vagrant
  • UI / UX
  • Architecture of …
  • Off-Topic
With ♥ from Berlin
October 19, 2014
Chris
LAMP, PHP
33

How to setup / install PHP 5.6 on Ubuntu 14.04 LTS

PreviousNext

Ubuntu 14.04 LTS ships with PHP 5.5 by default, but if you want to use PHP 5.6, then it’s just 3 lines on the command line away. Please note that this tutorial is for installing on a fresh and untouched Ubuntu 14.04 LTS, not for updating an existing installation of PHP. This works perfectly on every tested Ubuntu 14.04 LTS.

1. Add PHP 5.6 package sources to your system:

sudo add-apt-repository ppa:ondrej/php5-5.6

and confirm with ENTER. If you get an error here, you need to install python-software-properties first (and then do the line above again):

sudo apt-get update
sudo apt-get install python-software-properties

2. Update

sudo apt-get update

3. Install PHP

sudo apt-get install php5

and confirm with “y” and ENTER. You’ll now already see “PHP 5.6.x” in the scrolling installation logs. To properly check the installed version of PHP do:

php5 -v

Voila! By the way, this extremely-easy-to-install PHP 5.6 package was created by Ondřej Surý, so consider donating him a beer or a coffee via his donation page.

This article was written quite a while ago (8 years), please keep this in mind when using the information written here. Links, code and commands might be outdated or broken.

Random articles

  • PHP 5.6.0 RC1 is availablePHP 5.6.0 RC1 is available
  • Hochlastseiten mit PHP, MySQL und Apache am Beispiel stern.de (deutscher Artikel)Hochlastseiten mit PHP, MySQL und Apache am Beispiel stern.de (deutscher Artikel)
  • How to install/setup a basic LAMP stack (Linux, Apache, MySQL, PHP) on Ubuntu 14.04 LTSHow to install/setup a basic LAMP stack (Linux, Apache, MySQL, PHP) on Ubuntu 14.04 LTS
  • PHP 5.6 announced, statically typed (!) “new” PHP announced by Facebook devsPHP 5.6 announced, statically typed (!) “new” PHP announced by Facebook devs
  • How to setup a local server (in a virtual machine) with Vagrant in PHPStormHow to setup a local server (in a virtual machine) with Vagrant in PHPStorm
  • How to install/setup a basic LAMP stack (Linux, Apache, MySQL, PHP) on Ubuntu 12.04 or Debian 7.0/7.1How to install/setup a basic LAMP stack (Linux, Apache, MySQL, PHP) on Ubuntu 12.04 or Debian 7.0/7.1
  • How to setup a (or multiple) server/LAMP-stack inside a virtual machine for local development with Vagrant and PuPHPetHow to setup a (or multiple) server/LAMP-stack inside a virtual machine for local development with Vagrant and PuPHPet
  • PHPStorm: 42 Tips and Tricks (47min video talk by Mikhail Vink at Dutch PHP Conference 2015)PHPStorm: 42 Tips and Tricks (47min video talk by Mikhail Vink at Dutch PHP Conference 2015)
  • What’s new in PHPStorm 9What’s new in PHPStorm 9
5.6LAMPPHPPHP 5.6
Share this

33 Comments

  • Khayrul
    October 28, 2017 10:04 am

    Remove installed PHP and manually install PHP

    Reply
  • Jeromin
    October 10, 2017 11:42 pm

    Actually the PPA has been renamed and is obsolete. The new one is ppa:ondrej/php
    See https://launchpad.net/~ondrej/+archive/ubuntu/php for reference

    Reply
  • Tim Ng
    June 25, 2017 12:00 pm

    php5 -v

    is this the right command?

    Reply
    • Chris
      June 25, 2017 10:22 pm

      The right command for what ?

      Reply
  • gvanto
    April 27, 2017 6:27 pm

    Thanks very helpful. Btw on Ubuntu 14.04 after I ran “apt-get install python-software-properties” still got error “apt-get-repository Command not found”. Needed to install “apt-get install software-properties-common” … then it worked

    Reply
  • a2htray
    April 26, 2017 3:41 am

    nice blog,

    Reply
  • thức ăn bổ phế
    March 23, 2017 10:12 pm

    I am really impressed with your writing skills and also with the layout on your
    blog. Is this a paid theme or did you modify it yourself?
    Either way keep up the excellent quality writing,
    it’s rare to see a nice blog like this one nowadays.

    Reply
  • mal
    February 13, 2017 4:30 am

    soap does not work? any help

    Reply
  • Joel
    June 23, 2016 2:29 pm

    Worked great, thank you!
    Also, you’ve got the wrong dontation link for Orej, it’s https://donate.sury.org

    Reply
  • Ricardo Augusto Coelho
    June 14, 2016 2:21 pm

    That PPA (ondrej/php5-5.6) is now deprecated. You should use this one instead:
    $ sudo add-apt-repository ppa:ondrej/php

    And then, update and install:
    $ sudo apt-get update
    $ sudo apt-get install php5.6

    Reply
    • anD
      February 17, 2017 12:58 pm

      Yes, please update the ppa to:
      sudo add-apt-repository ppa:ondrej/php

      http://stackoverflow.com/questions/40567133/cannot-add-ppa-ppaondrej-php5-5-6

      Reply
    • Chris
      September 29, 2017 5:59 pm

      Obrigado!

      Reply
  • Mohamed kaptan
    May 25, 2016 3:56 pm

    thanks

    Reply
  • Danilo Nascimento
    May 13, 2016 5:05 am

    Thanks!

    Reply
  • Theodore R. Smith
    April 12, 2016 6:24 pm

    This doesn’t seem to have php-fpm???

    Reply
  • Roman
    March 27, 2016 6:41 pm

    thanks, it worked for ubuntu 14.04

    Reply
  • MewX
    March 17, 2016 5:04 am

    Worked perfectly. But it doesn’t depend on `python-software-properties`.
    The command `apt-get install php5` runs on my ubuntu-15-minimal successfully.

    Reply
  • Gohanzo
    February 19, 2016 12:30 am

    Thanks, it helps a lot ;)

    Reply
  • Vlad Kanash
    January 30, 2016 2:38 pm

    Didn’t help. I get php 5.2 installed.

    Reply
    • Laura Trejo
      May 10, 2016 11:53 pm

      got the same

      $ php -v

      PHP 5.3.10-1ubuntu3.22 with Suhosin-Patch (cli) (built: Apr 20 2016 12:31:15)

      Reply
  • Mr Mackey
    September 18, 2015 10:51 pm

    They went away but was getting these quite a bit earlier, mmmkay:

    Cannot access PPA (https://launchpad.net/api/1.0/~ondrej/+archive/php5-5.69) to get PPA information, please check your internet connection.

    Reply
  • farib
    August 12, 2015 4:04 pm

    I did all this. and it says php5 already installed. i tried to update too. but still php 5.5.9

    Reply
  • Ron
    July 30, 2015 12:14 am

    Hmmm. Received an error on the initial command, then did the
    ‘sudo apt-get update’
    That generated this error:
    …
    Reading package lists… Done
    W: GPG error: http://ppa.launchpad.net trusty Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 4F4EA0AAE5267A6C

    Never had an error on ‘apt-get update’ before. Did 1st command cause this? Then
    ‘sudo apt-get install python-software-properties’ updates nothing.

    Reply
  • tleb
    July 19, 2015 8:43 pm

    Wow. I had done a `apt-get install lamp-server^` and realised it was 5.9. I needed 5.6 (that `foo(…$args)` is quite useful :D) and saw your article, did as instructed, expected everything to break, but no! No Apache configuration change, no need to restart Apache, just refreshed my `phpinfo()` page and the version had changed. Amazing job by the creator of this repo!

    Reply
  • Rohit Arora
    May 23, 2015 7:13 am

    You rock dude

    Reply
  • Bishal Paudel
    May 18, 2015 10:55 am

    Perfect. Thanks!

    Reply
  • Michael
    May 17, 2015 8:47 pm

    Unfortunately doesn’t work on my raspi… any suggestions?

    W: Fehlschlag beim Holen von http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu/dists/wheezy/main/source/Sources 404 Not Found
    W: Fehlschlag beim Holen von http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu/dists/wheezy/main/binary-armhf/Packages 404 Not Found

    The warnings are (half) in german, but what they say is that the packages could not be found…
    However it is working on my Ubuntu system, therefore i have no idea whats wrong with the raspberry.

    Reply
  • Vincent
    January 5, 2015 8:56 pm

    Fantastic. Worked perfectly. Thanks!

    Reply

Leave A Comment Cancel reply

css3-chrome-font

Google rolls out Chrome 37, finally fixes horrible font-rendering

Google has rolled out Chrome 37 today, a legendary milestone that fixes one of the most annoying “bugs” in frontend

hiphop php

Vote for “Hack” for HipHop/HHMV support (future style PHP) in PHPStorm 8

“Hack” will come. And “Hack” will change PHP, definitly. In case you never heard of it, have a look into

hiphop php

PHP’s HipHop outperforms PHP 5.5 with Zend OPCache and Nginx by 15-20 times

A very interesting benchmark on www.alexfu.it shows excellent comparisons of plain PHP on Nginx (PHP 5.3 I think) PHP on

nginx php 5.5

[Link] Set up Nginx with PHP 5.5 easily

As there are surprisingly no good tutorials on how to set up NGINX with PHP 5.5 properly, here’s an excellent

php

PHP 5.6 announced, statically typed (!) “new” PHP announced by Facebook devs

PHP 5.6 goes alpha PHP 5.6 has been announced for a while now, and these days things get serious (code-freeze,

php

PHP.net hacked, but most things are fine again

Between 22nd and 24th October 2013 php.net served JavaScript malware (that was built to use security holes in the usually

hack-php

The first micro framework written in Hack is there: hack-mvc !

It has been just a few months ago Hack has been first announced, but some awesome people have already developed

php-7

PHP 6.0 will be PHP 7

Germany’s excellent PHP Magazin just posted interesting news: The next major version of PHP will be PHP 7, the development

bitdeli git github stats

php-login goes #2 PHP script worldwide in BitDeli stats

Holy! I just checked the stats of my little php-login hobby project on BitDeli (the tracking service for GitHub) and

phpstorm-8

Killer-feature in PHPStorm: Search everywhere

A short but massive productivity improvement: The new “search everywhere” feature in PHPStorm 7.1+! Simply double-tap the SHIFT key and

1/4

Categories

Search

Joshua Davis – my hero of Flash – in two excellent interviews (audio, video)
How to show the available version of a package (before doing apt-get install)
A collection of beautiful ajax loaders / spinners in pure .svg / CSS
Adobe releases Firebug-like developer tools to edit and extract PSDs
php
Postmodern PHP: appserver.io, a multithreaded application server for PHP, written in PHP
forbes 30 under 30
Need motivation ? Check out these 2 awesome “FORBES 30 under 30” lists (web, UI, games)
php
How to install PHP curl extension (in 5 seconds)
offf-2014
Europeans: Get ready for OFFF conference / festival in Barcelona, May 2014
sass laravel
SASSmeister is a real-time JSfiddle for SASS / CSS. Awesome!
Frontend Ops Conf 2014 – Paul Irish: Delivering The Goods In Under 1000ms (40min video)
js javascript
[video] Netflix JavaScript Talks about ECMAScript 7: The Evolution of JavaScript
Create a fast, perfect and bootable 1:1 Windows backup (full clone of HDD) for SSD migration
compress-png
Compress png, jpeg, gif and svg up to 90% with Compressor.io
Ghost
[FREE SERVER PROMO] Install GHOST for free on a free SSD server with this coupon
php
How to install latest PHP 5.4.x on Ubuntu 12.04 LTS (Precise Pangolin)

Tags

apache bash centos composer conference coupon CSS debian fonts framework git GitHub hack HHVM HipHop HTML HTML5 IDE JavaScript JS LAMP laravel linux mod_rewrite MVC MySQL Nginx optimization PHP PHP 5.5 PHP 5.6 phpmyadmin PHPStorm security server SSD Ubuntu UI UX vagrant video virtual machine voucher VPS wordpress
Side-Project: Wordle-Solver:
www.wordle-helper.info

Pages

  • Privacy Policy
 
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT