Tuesday, September 25, 2012

Install/Upgrade To PHP 5.4.6 Under Ubuntu 12.04/11.10/Linux Mint 13/12



In this tutorial we will see how to install or upgrade to PHP 5.4.6 using an external PPA provided by Ondřej Surý which supports Ubuntu 12.04/11.10 or older and any Ubuntu-based system like Linux Mint 13/12. PHP 5.4.6 fixes many bugs, you can check the full changelog of version 5.4.6 here.  PHP 5.4.7 is also released and still not available in the PPA, but will be added soon.

If you haven't already installed Apache2 and MySQL on your system, then do with the following commands:

sudo apt-get install -y mysql-server mysql-client apache2

Installing PHP 5.4.6

Via the terminal, issue these commands:

sudo add-apt-repository -y ppa:ondrej/php5
sudo apt-get update
sudo apt-get install -y php5 libapache2-mod-php5

Restart now Apache2 with this command:

sudo /etc/init.d/apache2 restart

To check if the installation of PHP 5.4.6 is successful, run this command:

php5 -v

$  php5 -v
PHP 5.4.6-2~precise+1 (cli) (built: Aug 30 2012 14:38:34)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologie

Or create a PHP file with this command:

echo "" | sudo tee /var/www/test.php

Restart Apache2:

sudo /etc/init.d/apache2 restart

Open now this URL (replace localhost with your own server IP address if needed):

http://localhost/test.php



No comments:

Post a Comment