PHP INSTALLATION ON UBUNTU-12.04

First, we need to update our local package index to make sure we have a fresh list of the available packages. Then we can install the necessary components.

$ apt-get update

Output

Step-1:Installing PHP

To install PHP, first you need to install Apache and MySql. Now download php using the below commands.

$ add-apt-repository ppa:ondrej/php
$ apt-get update
$ apt-get install -y php5.6 php5.6-mcrypt php5.6-gd

Output

Output

Note: If there is an error in add-apt-repository, then try below command

$ apt-get install software-properties-common
or
$ apt-get install python-software-properties

2.2 PHP INSTALLATION ON UBUNTU-14.04

First, we need to update our local package index to make sure we have a fresh list of the available packages. Then we can install the necessary components.

$ apt-get update

Output

Step-1:Installing PHP

To install PHP, first you need to install Apache and MySql. Now download php using the below commands.

$ add-apt-repository ppa:ondrej/php
$ apt-get update
$ apt-get install -y php5.6 php5.6-mcrypt php5.6-gd

Output

Output

Note: If there is an error in add-apt-repository, then try below command

$ apt-get install software-properties-common
or
$ apt-get install python-software-properties

2.3 PHP INSTALLATION ON UBUNTU-16.04

First, we need to update our local package index to make sure we have a fresh list of the available packages. Then we can install the necessary components.

$ apt-get update

Output

Step-1:Installing PHP

To install PHP, first you need to install Apache and MySql. Now download php using the below commands.

$ add-apt-repository ppa:ondrej/php
$ apt-get update
$ apt-get install -y php5.6 php5.6-mcrypt php5.6-gd

Output

Output

Note: If there is an error in add-apt-repository, then try below command

$ apt-get install software-properties-common
or
$ apt-get install python-software-properties