LAMP is an acronym that stands for Linux Apache, MySQL/MariaDB and PHP. i have LAMP installation post for PiHome but i see lots and lots of people are looking for setting up php 7 with phpMyAdmin and MariaDB on raspberry pi and there isn’t any comprehensive set of instruction that covers this all for PHP 7, MariaDB on raspberry pi.

If you are installing LAMP on your Raspberry Pi for PiHome you can refer to this post as php 7 isn’t supported yet. Follow OS (Raspbian Jessie) Installation and WiFi Configuration posts to install and get WiFi configured without any screen connected to Raspberry pi.

Update System

Issue following commands to update your raspberry pi.

Install Apache Server

Lets install Apache 2 web server on raspberry pi alone with common packages, you can add extra packages as your need.

Raspberry Pi Apache 2 Installation

Raspberry Pi Apache 2 Installation

Now you are test your apache2 installation. In your browservisit the IP address of your raspberry pi, you should see default Debian page.

Apache 2 Installation Testing on Raspberry Pi

Apache 2 Installation Testing on Raspberry Pi

Add New Repository Sources

As to date PHP 7.0 hasn’t added to the official repository sources, so you need to add one which provides the PHP 7.0 packages. issue following commands to add new repository source.

Now add some certificates to use the sources we just added with apt-get.

Add Repository Sources for PHP 7

Add Repository Sources for PHP 7

After successfully adding source and certificates now time to update packages list.

Install PHP 7 on Raspberry Pi

We are ready to install PHP 7 along with some common packages that you may need for web application.

Raspberry Pi PHP 7 Installation

Raspberry Pi PHP 7 Installation

Once Php 7 get installed successfully you can test php and Apache installation.

Install MariaDB Server on Raspbian

With the new version of Raspbian MariaDB is now present in the official repositories, To install it, you just need to run the following command

During MariaDB Server installation you will be asked to set password for the MariaDB Administrative root user.

MariaDB Server on Raspberry Pi set password Administrative root user.

MariaDB Server on Raspberry Pi set password Administrative root user.

Confirm password for Administrative root user.

MariaDB Server on Raspberry Pi confirm password Administrative root user.

MariaDB Server on Raspberry Pi confirm password Administrative root user.

Install phpMyAdmin on Pi with PHP 7 and MariaDB Server

phpMyAdmin isn’t required but it will make your life easier if you need to do any troubleshooting for MariaDB/MySQL Database server.

Install phpMyAdmin on Pi with PHP 7 and MariaDB Server

Install phpMyAdmin on Pi with PHP 7 and MariaDB Server

phpMyAdmin Password of the Database's administrative user

phpMyAdmin Password of the Database’s administrative user

Configuring phpMyAdmin: MySQL/MariaDB application password for the phpmyadmin

Configuring phpMyAdmin: MySQL/MariaDB application password for the phpmyadmin

Configuring phpMyAdmin: MySQL/MariaDB application password for the phpmyadmin confirmation

Configuring phpMyAdmin: MySQL/MariaDB application password for the phpmyadmin confirmation

Apache Configuration for phpMyAdmin

Configure Apache to work with phpMyAdmin. Edit /etc/apache2/apache2.conf and go to end of file.

Add following line and then CTRL+O to save changes and then CTRL+X to exit.

Now restart Apache web server, if everything was correct Apache service should start successfully.

Now you can test phpmyadmin from your browser http://<pi ip address>/phpmyadmin