A LAMP (Linux, Apache, MySQL, PHP) stack is a common web stack used for hosting web content.
In this guide tutorial we are going to show you how to install and test a LAMP stack with php7 on Ubuntu 16.04 (LTS).
Step 0. Update the system
# apt-get update # apt-get upgrade
Step 1. Install Apache
– Install apache2 and Apache library:
# apt-get install apache2 libapache2-mod-php
– Enable / Start Apache:
# systemctl enable apache2 # systemctl start apache2
Step 2. Install MySQL Server
– Install MySQL Server:
# apt-get install mysql-server php7.0-mysql
– Enable / Start MySQL Server:
# systemctl enable mysql # systemctl start mysql
Step 3. Install PHP 7 and PHP Modules
– Install PHP7:
# sudo apt-get install php7.0 php7.0-mysql php7.0-curl php7.0-gd php7.0-json php7.0-opcache php7.0-xml mcrypt php7.0-mcrypt
– Restart Apache:
# systemctl restart apache2
Step 4. Verify and Test PHP
– Create an info.php file to ensure PHP is running:
# sudo vi /var/www/html/info.php
– Paste the following content:
<?php phpinfo(); ?>
– Open in the web browser:
http://your server's IP address/info.php
We hope this tutorial was enough Helpful. If you need more information, or have any questions, just comment below and we will be glad to assist you!
PS. If you like this post please share it with your friends on the social networks using the buttons below.Thanks.