Bukit Mertajam, Penang

Install LAMP Web Server on Raspberry Pi

Introduction

LAMP is refer to Linux-Apache-MySQL-PHP. For those project that involve in IT, web server and database is a common thing. Normally student will setup web server and database on their personal laptop/PC. It is a bit risky especially when you do other important stuff on the same laptop. So replacing web server on your laptop to Raspberry Pi is a better alternative.

Video

This video will show you how to install LAMP Web Server on Raspberry Pi.

Command Line

Install the apache2 package by typing the following command into the terminal and pressing Enter:

sudo apt-get install apache2

Install the PHP and Apache packages with the following command:

sudo apt-get install php

To test PHP, go to default web page.

cd /var/www/html

Create PHP file named index.php and write your PHP script.

sudo leafpad index.php

Example for PHP script:

<?php
echo "Hello World!</br>";
echo date('Y-m-d H:i:s');
phpinfo();
?>

Delete index.html on default web page

sudo rm index.html

Install the MySQL Server and PHP-MySQL packages by entering the following command into the terminal window:

sudo apt-get install mysql-server php-mysql

Restart Apache:

sudo service apache2 restart

Related Products

You can consider to buy the product from the list below.

Thank You

References

  1. Build a LAMP Web Server with WordPress

Thanks for reading this tutorial. If you have any technical inquiry, please post at Cytron Technical Forum.

Leave a comment

Loading...