- Raspberry Pi (Setup & connected to the internet)
Open the command line.
Install Apache (Hosting system):
sudo apt-get install apache2 -y
Lets break this code up:
sudo: this gives you permission to do this
apt-get install: tells the system to install something
apache2: the package being installed
-y: tells the system that it can do it
Once Apache has been installed we need to install PHP:
sudo apt-get install php -y
Open your the file manager and navigate to /var/www/html.
These are the files that are hosted. Open the command line again and set the permissions for the folder:
sudo chown pi:root /var/www/html/
Go back to file manager and right-click index.html and then press rename and call the file index.php. Right click again and press Geany Programmer’s Editor
It should look like this:
Enter a piece of PHP to show the time:
<?php $date = date("F j, Y, g:i:s a"); echo $date ?>
Press CTRL + S to save it.
Open terminal again and enter:
You will get you IP address. Enter this on any device on you network to access the page. This is what it will look like:
See HTML to add text.