User Tools

Site Tools


raspberry_pi:projects:lamp_server

This is an old revision of the document!


Build a LAMP Web Server with WordPress

Learn to set up a LAMP (Linux, Apache, MySQL, PHP) stack on your Raspberry Pi and configure it to work as a web server.

  • Install software on your Raspberry Pi
  • Install and configure Apache, PHP, and MySQL to create a LAMP web server

Set up an Apache web server

Type the following command into the terminal and press Enter to install apache2

  sudo apt install apache2 -y
  

Install PHP

PHP is a preprocessor: it’s code that runs when the server receives a request for a web page via a web browser. It works out what needs to be shown on the page, and then sends that page to the browser.

Type the following command in the terminal to install PHP:

  sudo apt install php -y

Test PHP

Type this command to delete the index.html file from earlier:

  sudo rm index.html

Create a new file called index.php:

  sudo nano index.php

In the nano code editor, type this PHP code into the file and save it.

  <?php echo "hello world"; ?>

Refresh your browser. You should see “hello world”. This page is not dynamic, but it is still served by PHP.

raspberry_pi/projects/lamp_server.1738829852.txt.gz · Last modified: 2025/02/06 08:17 by jmbargallo