Step 1: Linux Distribution
In order to install LAMP (Linux Apache MySQL and PHP), you are required to install a linux distribution as first. For my case in Raspberry Pi 3, (i.e. Raspbian)in 「NOOBS」 can be downloaded or select a distro as you wish.
Step 2: Apache
Web server such as Apache2 (or Nginx) can be installed via command line after login as root or administrator. You are suggested to update and upgrade the system then install the apache2 as below. Default directory /var/www/html/ and a static page index.html will be created in local at Port 80.
#sudo apt-get update
#sudo apt-get upgrade
#sudo apt-get install apache2 -y
Open your web browswer and type in http://localhost:80, a web page is showing 「It work」. Then, it is mean that your web server is working.
Step 3: MySQL
MySQL is an open source database server which provide a core for searching and storage of dynamic data of user and web content. Modules can be installed to link other programming language and functions.
#sudo apt-get install mysql-server mysql-client
Step 4: PHP
PHP is a programming language with full range of functions to react with web browswer, database and system calls.
#sudo apt-get install libapache2-mod-php7 php7 php-pear php7-xcache php7-mysql php7-curl php7-gd
#sudo rm index.html
#sudo echo 「<?php phpinfo(); ?>」 | sudo tee index.php
#sudo service apache2 restart
Open your web browswer and type in http://localhost:80, a web page is showing 「Information and status of PHP」. Then, it is mean that your web server and php are working.