The Apache web server is the most commonly used web server application in the world. Today we are going to show you how to setup Apache web server with PHP, MySQL database server in your Raspberry Pi.
1.Setup your SD card with Raspbian OS with this tutorial.
2.In order to control your Raspberry from your PC you can use SSH or VNC and to setup VNC server in your Raspberry Pi follow this tutorial. To Access SSH enter ssh pi@<IP> in the terminal or you can use Putty in Windows.
1.Enter the Raspberry Pi Terminal.
2.Install Apache using this command.
sudo apt-get install apache2
3.Install MySQL database server using the command. Enter the root password for the MySQL database while installing.
sudo apt-get install mysql-server
4.Install php5 using the command.
sudo apt-get install php5 php5-mysql
5.After installing the packages to start the Apache Web Server using the command
service apache2 start
Now you your web server will start working. Visit Raspberry Pi’s IP in your PC to check whether its working.
The default web directory in Raspberry Pi is /var/www. Change the directory in the file /etc/apache2/sites-available/default
1.Move to the directory /var/www
2.Then sudo nano index.php
3. Paste the contents in the file and save it.
<?php phpinfo(); ?>
4.Now open <IP>/index.php you will see the PHP configuration in your Raspberry Pi.
Any questions comment here.