Setup a Raspberry Pi PHP web server

Lighttpd is a lightweight web server, with all the essential functions of a web server, PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. This is a tutorial on how to install Lighttpd and PHP on a Raspberry Pi.

Step 1: Prerequisite

Step 2: Connect the Raspberry Pi

Connect the Raspberry Pi to the computer via a network cable, the monitor, keyboard or mouse does not have to be connected, everything is remotely controlled by the computer through SSH software.

The Raspberry Pi is automatically set to obtain an IP address from your wired or wireless network. You must find its IP address before you can SSH to Raspberry Pi.

Step 3: Find the IP address of the Raspberry Pi

There are many ways to find the IP address , I'm preferring the SoftPerfect Network Scanner software which is available here.

Launch SoftPerfect Network Scanner

Select Options>IP address>Detect Local IP Range from menu as shown in figure above:

I'm select 192.168.0.138 for the network's IP range, it is the IP address of my computer

After select the network's IP range, click on Start Scanning icon to start the scanner
The IP address of Raspberry Pi is detected as 192.168.0.223 as shown in figure below

Step 4: SSH to Raspberry Pi

Launch PuTTY and SSH to Raspberry Pi, from here you can start the web server software installation. The login user and password is pi and raspberry respectively.Setup a Raspberry Pi PHP web server schematic

Step 5: Install Lighttpd & PHP

Lighttpd is a lightweight web server, with all the essential functions of a web server

sudo apt-get update #download package lists from the repositories

sudo apt-get -y install lighttpd .

Install PHP

PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language.

sudo apt-get -y install php5-common php5-cgi php5

sudo lighty-enable-mod fastcgi-php #Enable the Fastcgi module which will handle the PHP pages

 

For more detail: Setup a Raspberry Pi PHP web server


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top