Apache is a very popular Web Server Web Application where you can install on Raspberry Pi 2 which provides you various web pages for your requirement.Apache can provide you various HTML Pages along with other Powerful Scripting Languages like PHP.
Let us see the installation go Apache in Raspberry Pi 2:
sudo apt-get update
sudo apt-get install apache2 -y
That’s it! Installation Done Successfully.
Test the working of Apache(Web Server):
Open you Raspberry Pi browser or any other System browser which is available in the same network and type Raspberry Pi IP address you should the following message which means your Apache is working fine.
The default webpage is located in the following path
You can create you own html page and replace it here!!
To process PHP files in apache server we need to install PHP5 and PHP5 module for apache.
Type the following commands to install PHP5 and its Module.
sudo apt–get install php5 libapache2–mod–php5 –y
Now remove the index.html file from Apache server replace it with index.php and write some php to content to check the working.I am writing a simple hello world and displaying date and time.
<?php echo "hello world"; <?php echo date('Y-m-d H:i:s');
Now reload your page in browser ,you should see the changes 🙂
For more queries: