Tutorials

How to upgrade PHP 5.3 to PHP 5.6 on Ubuntu 12.04 with Nginx

If you want to upgrade your PHP 5.3 to PHP 5.6 running on Ubuntu 12.04 with nginx, you need to follow these steps :

Step 1: Add the PPA repository for PHP 5.6

sudo  add-apt-repository ppa:ondrej/php

If you are logged in as the root user, you can leave out 'sudo' from the above command

If you see an error like this :

sudo: add-apt-repository: command not found
this means that you need to install the package python-software-properties
sudo apt-get install python-software-properties

Now run the first command, to add the PPA again.

Step 2: Install PHP 5.6 to your server, but before that, backup your php.ini file

cp /etc/php5/fpm/php.ini /etc/php5/fpm/php-backup.ini

Now we install PHP 5.6, along with the most common packages required for WordPress sites with Nginx.

sudo apt-get update
sudo apt-get install php5.6-cli php5.6-common php5.6 php5.6-mysql php5.6-fpm php5.6-curl php5.6-gd php5.6-soap php5.6-mbstring php5.6-zip php5.6-mcrypt php5.6-xml

You might be asked, if you wish to replace the current php.ini file with a new one. Select yes for that and replace your existing php.ini with the new one.

You can update the changes you had made in the previous php.ini file to the new one, by comparing it with the php-backup.ini file


Copyright © 2018 WPOven