How to install PHP on Ubuntu 14.04?

To get you started with installing PHP and Apache on VPS or Dedicated server running Ubuntu 14.04 OS use following command:


apt-get update && apt-get upgrade

apt-get install -y apache2


After this, you may verify that the Apache gets installed by opening the browser and going to link- http://your-ip-address



Now, that you’ve installed Apache, it’s time to install PHP with following command:

apt-get install -y php5 libapache2-mod-php5 php5-mcrypt php5-cli


After that, you need to verify if everything works accurately, just create a PHP info file as given below:

cd /var/www/html/

vi index.php

Then, paste following command in the file:


Then close the file as below,


Now, since the file has been written, restart Apache

apachectl restart


Since installation is now complete, go to the following link:


And page as shown below will appear on screen:


A section will be created in the php info file as created by you- Loaded Configuration File

This is going to be the ini file used for your PHP installation.

Editing PHP.ini


Configuration file ‘php.ini’ is read after PHP is started. This occurs only once when web server is started for server module versions of PHP.

  1.    cd /etc/php5/apache2
  2.    vi php.ini

Activate logging and uncomment the following:

;error_log = php_errors.log

and make sure that: short_open_tag = Off

Development be: error_reporting = E_ALL

Production should be: error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT


  • 81 Users Found This Useful
Was this answer helpful?

Related Articles

Recieving an "ip_conntrack: table full" error.

On OpenVZ/HyperVM machines sometimes the ip_conntrack table will become full and drop packets....

How to do MySQL Troubleshooting?

MySQL is a database server used for large data storage and retrieval, yet the default...

Why is cPanel/WHM not loading?

There are two main reasons why cPanel/WHM isn't loading that we've seen. Brand New Server If...

How to restore your MySQL database?

  This article applies to Rackbank Dedicated Servers running Plesk-  To get started with...

Webmin has an SSL error.

If you try to log into a new install and you receive this error: An error occurred during a...