How to install PHP 5 on Ubuntu 15.10?

In tutorial I will show you how you can use apt-get tool for installing PHP 5 on Ubunut 15.10 Desktop operating system?

How to install PHP 5 on Ubuntu 15.10?

How to install PHP 5 on Ubuntu 15.10?

Ubuntu provides easy to use apt-get tool for installing new software packages on the system. In this video tutorial I have use the apt-get tool for installing PHP 5 and its one module on the Ubunut 15.10 operating System.

The latest version of PHP 5 comes with many new and advanced features with the support for development of dynamic web applications. You can easily install apache 2, php and MySQL using this tool.

Here is the video tutorial of "How to install PHP and modules in Ubuntu? ":

What is the command to install PHP 5 on Ubuntu?

Ubuntu is Debian base distribution of Linux operating system with world class server and desktop features. You can use Ubuntu as Desktop operating system as well as Server Operating system for hosting your applications.

In this tutorial I have explained the command for installing PHP 5. You can use the following command to install PHP 5 and its one library PHP curl:

sudo apt-get install php5 php5-curl

To run the command you have to first login to your Ubunut desktop or Server and then open terminal. You can login to your server remotely using putty tool.

After entering above command installer will download and install PHP 5 on your computer.

Here is the complete output of the command:

deepak1@deepak1-VirtualBox:~$ sudo apt-get install php5 php5-curl
[sudo] password for deepak1: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php5 libapr1
  libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 php5-cli
  php5-common php5-json php5-readline
Suggested packages:
  apache2-doc apache2-suexec-pristine apache2-suexec-custom php-pear
  php5-user-cache
The following NEW packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php5 libapr1
  libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 php5
  php5-cli php5-common php5-curl php5-json php5-readline
0 upgraded, 16 newly installed, 0 to remove and 52 not upgraded.
Need to get 6,527 kB/6,613 kB of archives.
After this operation, 27.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu/ wily/main libaprutil1 amd64 1.5.4-1 [78.3 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu/ wily/main libaprutil1-dbd-sqlite3 amd64 1.5.4-1 [10.7 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu/ wily/main libaprutil1-ldap amd64 1.5.4-1 [8,788 B]
Get:4 http://in.archive.ubuntu.com/ubuntu/ wily/main liblua5.1-0 amd64 5.1.5-8 [102 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu/ wily/main apache2-bin amd64 2.4.12-2ubuntu2 [922 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu/ wily/main apache2-utils amd64 2.4.12-2ubuntu2 [82.9 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu/ wily/main apache2-data all 2.4.12-2ubuntu2 [160 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu/ wily/main apache2 amd64 2.4.12-2ubuntu2 [91.3 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu/ wily-updates/main php5-common amd64 5.6.11+dfsg-1ubuntu3.1 [484 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu/ wily/main php5-json amd64 1.3.7-1 [18.2 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu/ wily-updates/main php5-cli amd64 5.6.11+dfsg-1ubuntu3.1 [2,249 kB]
Get:12 http://in.archive.ubuntu.com/ubuntu/ wily-updates/main libapache2-mod-php5 amd64 5.6.11+dfsg-1ubuntu3.1 [2,277 kB]
Get:13 http://in.archive.ubuntu.com/ubuntu/ wily-updates/main php5 all 5.6.11+dfsg-1ubuntu3.1 [1,298 B]
Get:14 http://in.archive.ubuntu.com/ubuntu/ wily-updates/main php5-curl amd64 5.6.11+dfsg-1ubuntu3.1 [27.9 kB]
Get:15 http://in.archive.ubuntu.com/ubuntu/ wily-updates/main php5-readline amd64 5.6.11+dfsg-1ubuntu3.1 [13.1 kB]
Fetched 6,527 kB in 3min 44s (29.1 kB/s)                                       
Selecting previously unselected package libapr1:amd64.
(Reading database ... 225818 files and directories currently installed.)
Preparing to unpack .../libapr1_1.5.2-3_amd64.deb ...
Unpacking libapr1:amd64 (1.5.2-3) ...
Selecting previously unselected package libaprutil1:amd64.
Preparing to unpack .../libaprutil1_1.5.4-1_amd64.deb ...
Unpacking libaprutil1:amd64 (1.5.4-1) ...
Selecting previously unselected package libaprutil1-dbd-sqlite3:amd64.
Preparing to unpack .../libaprutil1-dbd-sqlite3_1.5.4-1_amd64.deb ...
Unpacking libaprutil1-dbd-sqlite3:amd64 (1.5.4-1) ...
Selecting previously unselected package libaprutil1-ldap:amd64.
Preparing to unpack .../libaprutil1-ldap_1.5.4-1_amd64.deb ...
Unpacking libaprutil1-ldap:amd64 (1.5.4-1) ...
Selecting previously unselected package liblua5.1-0:amd64.
Preparing to unpack .../liblua5.1-0_5.1.5-8_amd64.deb ...
Unpacking liblua5.1-0:amd64 (5.1.5-8) ...
Selecting previously unselected package apache2-bin.
Preparing to unpack .../apache2-bin_2.4.12-2ubuntu2_amd64.deb ...
Unpacking apache2-bin (2.4.12-2ubuntu2) ...
Selecting previously unselected package apache2-utils.
Preparing to unpack .../apache2-utils_2.4.12-2ubuntu2_amd64.deb ...
Unpacking apache2-utils (2.4.12-2ubuntu2) ...
Selecting previously unselected package apache2-data.
Preparing to unpack .../apache2-data_2.4.12-2ubuntu2_all.deb ...
Unpacking apache2-data (2.4.12-2ubuntu2) ...
Selecting previously unselected package apache2.
Preparing to unpack .../apache2_2.4.12-2ubuntu2_amd64.deb ...
Unpacking apache2 (2.4.12-2ubuntu2) ...
Selecting previously unselected package php5-common.
Preparing to unpack .../php5-common_5.6.11+dfsg-1ubuntu3.1_amd64.deb ...
Unpacking php5-common (5.6.11+dfsg-1ubuntu3.1) ...
Selecting previously unselected package php5-json.
Preparing to unpack .../php5-json_1.3.7-1_amd64.deb ...
Unpacking php5-json (1.3.7-1) ...
Selecting previously unselected package php5-cli.
Preparing to unpack .../php5-cli_5.6.11+dfsg-1ubuntu3.1_amd64.deb ...
Unpacking php5-cli (5.6.11+dfsg-1ubuntu3.1) ...
Selecting previously unselected package libapache2-mod-php5.
Preparing to unpack .../libapache2-mod-php5_5.6.11+dfsg-1ubuntu3.1_amd64.deb ...
Unpacking libapache2-mod-php5 (5.6.11+dfsg-1ubuntu3.1) ...
Selecting previously unselected package php5.
Preparing to unpack .../php5_5.6.11+dfsg-1ubuntu3.1_all.deb ...
Unpacking php5 (5.6.11+dfsg-1ubuntu3.1) ...
Selecting previously unselected package php5-curl.
Preparing to unpack .../php5-curl_5.6.11+dfsg-1ubuntu3.1_amd64.deb ...
Unpacking php5-curl (5.6.11+dfsg-1ubuntu3.1) ...
Selecting previously unselected package php5-readline.
Preparing to unpack .../php5-readline_5.6.11+dfsg-1ubuntu3.1_amd64.deb ...
Unpacking php5-readline (5.6.11+dfsg-1ubuntu3.1) ...
Processing triggers for man-db (2.7.4-1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (225-1ubuntu9) ...
Processing triggers for ufw (0.34-2) ...
Setting up libapr1:amd64 (1.5.2-3) ...
Setting up libaprutil1:amd64 (1.5.4-1) ...
Setting up libaprutil1-dbd-sqlite3:amd64 (1.5.4-1) ...
Setting up libaprutil1-ldap:amd64 (1.5.4-1) ...
Setting up liblua5.1-0:amd64 (5.1.5-8) ...
Setting up apache2-bin (2.4.12-2ubuntu2) ...
Setting up apache2-utils (2.4.12-2ubuntu2) ...
Setting up apache2-data (2.4.12-2ubuntu2) ...
Setting up apache2 (2.4.12-2ubuntu2) ...
Enabling module mpm_event.
Enabling module authz_core.
Enabling module authz_host.
Enabling module authn_core.
Enabling module auth_basic.
Enabling module access_compat.
Enabling module authn_file.
Enabling module authz_user.
Enabling module alias.
Enabling module dir.
Enabling module autoindex.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module filter.
Enabling module deflate.
Enabling module status.
Enabling conf charset.
Enabling conf localized-error-pages.
Enabling conf other-vhosts-access-log.
Enabling conf security.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Setting up php5-common (5.6.11+dfsg-1ubuntu3.1) ...

Creating config file /etc/php5/mods-available/pdo.ini with new version
php5_invoke: Enable module pdo for cli SAPI
php5_invoke: Enable module pdo for apache2 SAPI

Creating config file /etc/php5/mods-available/opcache.ini with new version
php5_invoke: Enable module opcache for cli SAPI
php5_invoke: Enable module opcache for apache2 SAPI
Setting up php5-json (1.3.7-1) ...
php5_invoke: Enable module json for cli SAPI
php5_invoke: Enable module json for apache2 SAPI
Setting up php5-cli (5.6.11+dfsg-1ubuntu3.1) ...
update-alternatives: using /usr/bin/php5 to provide /usr/bin/php (php) in auto mode

Creating config file /etc/php5/cli/php.ini with new version
Setting up php5-curl (5.6.11+dfsg-1ubuntu3.1) ...

Creating config file /etc/php5/mods-available/curl.ini with new version
php5_invoke: Enable module curl for cli SAPI
php5_invoke: Enable module curl for apache2 SAPI
Setting up php5-readline (5.6.11+dfsg-1ubuntu3.1) ...

Creating config file /etc/php5/mods-available/readline.ini with new version
php5_invoke: Enable module readline for cli SAPI
php5_invoke: Enable module readline for apache2 SAPI
Processing triggers for ufw (0.34-2) ...
Setting up libapache2-mod-php5 (5.6.11+dfsg-1ubuntu3.1) ...

Creating config file /etc/php5/apache2/php.ini with new version
Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
apache2_invoke: Enable module php5
Setting up php5 (5.6.11+dfsg-1ubuntu3.1) ...
Processing triggers for libc-bin (2.21-0ubuntu4) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (225-1ubuntu9) ...

After the completion of the installation you use the php --version command to see the version of PHP installed on your computer. Here is the usage:

deepak1@deepak1-VirtualBox:~$ php --version
PHP 5.6.11-1ubuntu3.1 (cli)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
deepak1@deepak1-VirtualBox:~$

Check 1000s of tutorials of PHP in our PHP Tutorials section.