LAMP (Linux, Apache, MySQL and PHP) on Raspberry PI

Install LAMP (Linux, Apache, MySQL and PHP)

From:  <>

Install Apache

sudo apt-get install apache2 -y

Install PHP
Test by going http://localhost/ or http://raspberrypi/ if installing trough SSH

sudo apt-get install php5 libapache2-mod-php5 -y
sudo apt-get install php5-gd -y

Restart apache

sudo /etc/init.d/apache2 restart

Test PHP

sudo nano /var/www/html/testphp.php

Paste this in file

<?php phpinfo(); ?>

Ctrl-X and save

And test http://raspberrypi/testphp.php

You should see php info page

Install MySQL

sudo apt-get install mysql-server -y

Set root password for MySQL root during the installation

Install phpMyAdmin

sudo apt-get install php5-mysql phpmyadmin -y

Create database

  • Choose apache2
  • And give and set password

Test http://raspberrypi/phpmyadmin user:root pass:<your-pass>