Knowledgebase


Portal Home > Knowledgebase > Linux > Common Issues > How to install PHP on Ubuntu 14.04?


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:

phpinfo();

Then close the file as below,

:wq

Now, since the file has been written, restart Apache

apachectl restart

 

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

http://your-ip-address/index.php

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

 



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read

Language: