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

shadow dom

Crossbrowser-safe HTML5 video (IE6+) with a few lines of code and just one .mp4 video file

No time to read the full article ? Get the code directly here on GitHub: panique/html5-video. Publishing a video on

php

How to prevent PHP sessions being shared between different apache vhosts / different applications

When you run multiple applications on one server, you might run into the session-sharing problem: All your applications share the

october cms

October CMS, built on top of Laravel, is beautiful, clever and on the way to be the new #1 CMS

Do you remember when you tried to edit one line of code inside TYPO3 or Contao ? And the extreme

php

Postmodern PHP: appserver.io, a multithreaded application server for PHP, written in PHP

There’s a lot of very interesting stuff going on in the PHP scene right now, I have the feeling this

How to show the available version of a package (before doing apt-get install)

To show the version of the package that will be installed with apt-get install, do apt-cache policy packagename. To show

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

js javascript

JavaScript Testing Tactics (21min video by Justin Searls)

ilovepreloaders – A tumblr collection of preloader animations

An excellent collection of preloaders (GIFs, Movies and real ready-to-copy&paste code) here in this wonderful blog: http://ilovepreloaders.tumblr.com/ This thing just

cheap cloud server php

DigitalOcean rolls out interesting feature: Transfering server snapshots directly to the client’s account

Today DigitalOcean has rolled out a quite interesting new feature: You are now able to transfer a server snapshot (which

1/4

Categories

Search

vagrant
How to setup a (or multiple) server/LAMP-stack inside a virtual machine for local development with Vagrant and PuPHPet
goodbye-lamp-going-hhvm-nosql-nginx-php
[RePost] Goodbye LAMP: Going Nginx, NoSQL, HHVM (41min conference talk with Arne Blankerts)
(Links) How to fix an extremely slow Symfony inside a Vagrant box
[Link] Making a website vertically responsive
This is an experimental advertisement
php
Test out PHP 5.6alpha1 on Windows 7 / 8 with two clicks
php
Redesigning the PHP logo – who wants ?
ubuntu-14-04-lts lamp
How to install/setup a basic LAMP stack (Linux, Apache, MySQL, PHP) on Ubuntu 12.04 or Debian 7.0/7.1
php
Postmodern PHP: appserver.io, a multithreaded application server for PHP, written in PHP
Meet the developers behind Ableton (14min video)
[Link] Improving Smashing Magazine’s Performance: A Case Study
php
Why Modern PHP is Awesome And How You Can Use It Today (Slides by Matt Stauffer)
angularjs
Two excellent introductions into AngularJS by Todd Motto
php
How to prevent PHP sessions being shared between different apache vhosts / different applications
sass laravel
SASSmeister is a real-time JSfiddle for SASS / CSS. Awesome!

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