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 (9 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

php

Awesome list of Design Patterns with PHP code examples

Probably one of the most useful GitHub repositories ever: Dominik Liebler has published a well-reseached and well-written (PSR coding guidelines

What’s new in PHPStorm 10 (Official promo video)

PHPStorm 10 is out! New features are mainly full PHP7 support, much better auto-recognation / autocompletion (even within arrays (unsure

Experimenting with HHVM at Etsy (Link)

Extremely interesting blog post of Etsy on how they try out HHVM / HipHop: https://codeascraft.com/2015/04/06/experimenting-with-hhvm-at-etsy/ This article was written quite

bitdeli git github stats

Get visitor stats for your GitHub repo with BitDeli

GitHub is the definitive #1 “hoster” for git repositories, no question. And this highly sympathic company has made version control

php

Redesigning the PHP logo – who wants ?

The current PHP logo is a really lovely one, it is highly accepted and has its own charme, transports a

harper reed about big data

Harper Reed – The magic and mystery of Big Data (30min video from Webstock’15)

Harper Reed is speaking, so nothing can go wrong. :) The former CTO of Threadless.com and Obama for America definitly

mod-rewrite-ubuntu-14-04-lts

How to enable mod_rewrite in Ubuntu 12.04 LTS

A little note first: This is the most seen way to enable mod_rewrite in tutorials. However, it’s not the best

php

New GitHub repo: simple php-long-polling for creating real-time apps

Mornin’ ! I’ve just pushed a sweet little new project into GitHub: A very simple and totally reduced PHP long-polling

redaktionelle-hochlastseiten

Hochlastseiten mit PHP, MySQL und Apache am Beispiel stern.de (deutscher Artikel)

Eine grandiose Powerpoint-Präsentation die sich jeder, der mit PHP, MySQL und Apache auf Linux arbeitet, mal anschauen sollte: Nils Langner,

laracon-2014-eu-amsterdam

Laracon 2013 – Kapil Verma: Engineering Complex Applications with Laravel 4 (40min video)

More videos of 2013’s and 2014’s Laracon events from US and EU on their Youtube channel. This article was written

1/4

Categories

Search

Quick fix for 404 error in WordPress category / tag page
You made a mess with Git ? Here’s a flowchart guideline on how to fix
DEF CON 18 – When your computer got stolen and you can still SSH into it: “Pwned by the 0wner” (22min conference talk)
js javascript
How JavaScript really works – An introduction into the JavaScript call stack by Philip Roberts (20min video)
microsoft-windows-azure-cloud-hosting
Microsoft’s Azure platform gives away high money prizes for “testing out” their cloud services
phpstorm-8
PHPStorm 8 (early access version) released – for free
java vs php
Switching from Java to PHP. Seriously. A very interesting and pre-judice-free talk with Ph.D. Aris Zakinthinos
organizing css
Jonathan Snook – CSS is a Mess – How to organize CSS in big projects (54min video talk)
Hacking ATMs – A conference talk about the current security state of Windows XP driven cash machines
hiphop php
[Link] How to set up HipHop, Nginx and Laravel in Ubuntu 12.04 LTS (in a Vagrant box)
Bézier Curves – Under the Hood (4min video)
php
Is there a JSFiddle for PHP ? Yes !
gamescom 2014 trailers
GAMESCOM 2014: Awesome Next-Gen ingame graphics
java
Interesting: code of the same application in PHP, Python, Ruby, Closure, node.js, Java and Go
vagrant
Generate Vagrant boxes with Laravel, HipHop, Nginx, WordPress, MySQL, MariaDB, MongoDB, RabbitMQ etc. with one click

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