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
November 4, 2013
Chris
PHP, Ubuntu
Comments Off on How to install latest PHP 5.4.x on Ubuntu 12.04 LTS (Precise Pangolin)

How to install latest PHP 5.4.x on Ubuntu 12.04 LTS (Precise Pangolin)

PreviousNext
php

Disclaimer: Currently 5.5 is the very latest version of PHP, but the common way to install PHP 5.5 has a major disadvantage: It will also install Apache 2.4 or update your Apache 2.2 (standard!) to version 2.4, which will introduce new apache config files, removing current ones (!). No joke. As many apache tutorials teach people to change stuff in /etc/apache2/sites-available/default (which will be removed during Apache 2.4 installation) it might be a bad choice to install PHP 5.5. If you still want to install PHP 5.5, check these articles:

How to install/setup latest version of PHP 5.5 on Debian Wheezy 7.0/7.1/7.2
How to install/setup latest version of PHP 5.5 on Ubuntu 12.04 LTS (Precise Pangolin)

 

And now, let’s install the latest version of PHP 5.4

There’s an excellent and (usually) hassle-free method to install the latest version of PHP 5.4 with 3 simple bash commands:

1. Add this package-repository to your system. If Ubuntu says that you need to download a key first, then follow the instructions given in the notice.

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

If you get an error message now, then please do an update first and install the python-software-properties, that need to be necessary to add a package repository:

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

2. Update

sudo apt-get update

Check the available version of PHP (the result is self-explaining, the version on the top is the one that will be installed):

apt-cache policy php5

3. Install PHP 5.4.x

sudo apt-get install php5

Check the installed version of PHP (if this does not show 5.4.x please restart your apache)

php5 -v

Please note: The ondrej/php5-oldstable repository (which is used here) provides the very latest version of the PHP 5.4-branch. Usually a version-update is available a few days after it was been officially released. This is really cool and a big step forward as Ubuntu, Debian, CentOS etc. provide only very old versions by default.
 
[wp_ad_camp_2]
 

To UPDATE from PHP 5.3 to 5.4:

It’s also possible to update from any PHP version to 5.4 one with exactly the commands above. But, after doing

sudo apt-get install php5

you’ll have to restart the server with

sudo /etc/init.d/apache2 restart

or

sudo service apache2 restart

 

PHPphp 5.4Ubuntu
Share this

Support FLARUM, the future of PHP forum scripts (with some dollars on Kickstarter)

PHP forum scripts are horrible, let’s face it. Nearly everything that’s available is hard to install, hard to handle, hard

angular js

Learn AngularJS in 20 (or 90) minutes with Dan Wahlin

Definitly two of the best and most up-to-date short-introductions into AngularJS: Dan Wahlin shows how to build a full little

DEF CON 18 – When your computer got stolen and you can still SSH into it: “Pwned by the 0wner” (22min conference talk)

A fantastic masterpiece of a conference talk: Mac got stolen. Bummer! Two years later: owner SSHs into it (!), installs

php

[Link] Excellent PHP best practices, 2014 style

Excellent post on This interests me: A collection of useful best practices in modern PHP development, like Redirecting the user

Beautiful, minimal WordPress theme ZUKI by Elmastudio (with 30% discount)

First a little disclaimer: I’m not affiliated with the company, don’t get money (or anything else) for saying this and

phpstorm 7.0 php

How to install GitHub’s, NetBeans’s and Sublime2’s syntax highlighting code colours theme in PHPStorm 6/7

PHPStorm’s default code colouring might not be what you want, especially when you just switched from NetBeans. But there are

First look on Gitter, the chat for GitHub

GitHub has definitly become the #1 platform for git-based public repositories on the planet, no question. The site offers excellent

Joshua Davis – my hero of Flash – in two excellent interviews (audio, video)

Joshua Davis is the reason why I’ve started to code. Seriously. Back in the late 90ies, the internet was a

You made a mess with Git ? Here’s a flowchart guideline on how to fix

Extremely useful. Originally created by Justin Hileman in the presentation Changing History, or How to Git pretty. You’ll also find

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

1/4

Categories

Search

phpstorm-8
Killer-feature in PHPStorm: Search everywhere
composer
[Link] How to require versions of PHP, HHVM / HipHop, GD, curl, openssl etc. with Composer
“Fuck you. Pay Me.” How to deal with clients, the professional way. An excellent talk with Mike Monteiro.
shadow dom
A quick video introduction into Shadow-DOM, the game-changing DOM-subtree-technology
How to show memory usage (Ubuntu)
php
Slides from International PHP Conference 2014
vagrant
How to copy Vagrant boxes (or duplicate them)
redaktionelle-hochlastseiten
Hochlastseiten mit PHP, MySQL und Apache am Beispiel stern.de (deutscher Artikel)
sass laravel
Extremely easy SASS in Laravel (with pure PHP)
java vs php
Switching from Java to PHP. Seriously. A very interesting and pre-judice-free talk with Ph.D. Aris Zakinthinos
sass
New features in SASS 3.3 (a talk by SASS-creator Chris Eppstein)
composer
A short & simple Composer tutorial
Install Laravel 4 on Ubuntu 12.04 LTS (a how-to tutorial)
october cms
[Link] How To Install October CMS on a VPS running Ubuntu 14.04
[Link] Improving Smashing Magazine’s Performance: A Case Study

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