How to Install LAMP Stack

Prerequisites

Installing LAMP Stack

Step 1: Launch an Alibaba Cloud ECS Server

Step 2: Install Apache Server

apt-get update
apt-get install apache2
http://ip_of_server

Step 3: Install MySQL

sudo apt-get install mysql-server

Step 4: Install PHP

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt libapache2-mod-auth-mysql php5-mysql
  • libapache2-mod-php5 provides a PHP5 module for the Apache 2 and is compatible only with Apache's prefork MPM.
  • php5-mcrypt enables the data encryption for added security reasons.
  • libapache2-mod-auth-mysql, an Apache 2 module that enables extra HTTP authentication for data stored in MySQL.
  • php5-mysql includes the generic "MySQL" module which can be used to connect to all versions of MySQL.
vim  /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c >   DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml  index.htm    </IfModule >

Step 5: Confirm Installation

vim /var/www/html/info.php
<?php phpinfo(); ?>
sudo service apache2 restart
http://IPAddress/info.php

Original Source:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com