Ubuntu 12.04 LTS - Installing Later Versions of PHP (5.4 or 5.5)

To install the very latest php (5.5 at the time of this writing) in Ubuntu as well as use the native driver for MySQL which allows asynchronous queries, run the following commands:

sudo apt-get install python-software-properties -y
sudo add-apt-repository ppa:ondrej/php5 -y
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get install php5 php5-mysqlnd -y

Alternative 5.4 Installation

If you want, you can install 5.4 instead which is 'more stable', though I have yet to find an issue with the latest one.

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php5-oldstable
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get install php5 php5-mysqlnd -y

Handle UTF-8 Error

In the unlikely event that you see the error below:

Then you need to run this command before retrying

export LANG=C.UTF-8

Update

I just ran this tutorial again and noticed that my phpmyadmin would no longer work (installed from source). To fix this simply edit your
/etc/php5/apache2/php.ini
file and add the following line underneath Dynamic Extensions like so:
extension=mysqli.so

References

No comments:

Post a Comment