1: Install Apache2 and PHP in Raspberry Pi

Apache is a popular web server application. You can use Apache to access web pages on the Raspberry Pi 4B.

unixmen


To install Apache, follow the steps accordingly.

1) sudo apt update
2) sudo apt install apache2 -y

Then command "hostname -I" which will show your local IP address (e.g. 192.168.xx.xx)

Next, type the local IP address in any web browser.

If everything goes well, you will see "It works" in the Apache default page



PHP is an indispensable tool to create webpage.

To install PHP,  type "sudo apt install php libapache2-mod-php -y"

After that, remove the index.html. You can find it in /var/www/html/index.html

cd to the directory. Implement "sudo rm index.html"

Next, create index.php with help of "sudo nano index.php"

Then paste <?php phpinfo(); ?> there



If you see the above screen by typing your IP address, PHP is installed successfully.

Comments