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
- Raspberry Pi running Raspbian OS
- SSH client such as PuTTy
- If you like to use GUI ( Graphical User Interface), WinSCP is preferred
- Netscanner software for IP address searching
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.
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 .
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