Install Apache and PHP5 in Ubunutu Linux

Install Apache and PHP5 in Linux, If you are doing any development on PHP, then you need a PHP development environment in Linux with apache and php. Here I’ll show you process to install Apache, PHP5 and where to find configuration files, where to place your website files. Here I’m doing this Ubuntu Linux, before starting installation you need to update package lists from the repositories, then download them.

Install Apache and PHP5 in Linux

For updating packages list from the repositories and upgrading.
[bash] sudo apt-get update
sudo apt-get upgrade

It will takes few minutes to complete above action based on your internet connection speed.

1. Install Apache

For installing apache just use this command.

[bash] sudo apt-get install apache2

2. Install PHP

For installing PHP use this command in Linux terminal.
[bash] sudo apt-get install php5

Then create a connection between Apache & PHP, for that use this coommands.

[bash] sudo apt-get install libapache2-mod-php5

Then restart server for making any changes.
[bash] sudo /etc/init.d/apache2 restart

php.ini path in Linux Ubuntu – /etc/php5/apache2/php.ini

httpd.conf path in Linux Ubuntu – /etc/apache2/apache2.conf

Put your website files in – /var/www/

If you want to install PHP development environment as single installation then read this -> Installing Lamp on Linux Mint but you can install it on any linux distribution.

Vivek Vengala

Vivek Vengala is a Online Entrepreneur, Web Developer from Hyderabad India.