PHP Installation Process

PHP Installation Process

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 the below command

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