Winter Bootcamp in ML and IoT in Jaipur
 Course content (For Bootcamp & Winter Training):- Machine Learning (ML) || Internet of Things (IoT) || Register for winter bootcamp
0 like 0 dislike
in Tutorial & Interview questions by (3.1k points)

1 Answer

0 like 0 dislike
by (3.1k points)
Best answer

LAMP (Linux Apache MySQL PHP) consists of the Linux operating system as development environment, the Apache HTTP Server as web server, the MySQL relational database management system (RDBMS) as DB (Data Base) system, and the PHP programming language as Server side (Back End) programming language.

LAMP is used as a Open Source stack of technologies solution to web development area. Windows version of this stack is called WAMP (Windows Apache MySQL PHP)

Installing LAMP on Arch Linux

With this line we will install all the necessary packages in one step, and the last update:
pacman -Syu apache php php-apache mariadb




Change ServerAdmin as you need.

The folder of the WEB Pages by default is ServerRoot "/etc/httpd". Directory must be set to the same folder, so

change the line

<Directory "/etc/httpd">

This folder must have read and execution access, so

chmod o+x /etc/httpd

Change AllowOverride from none (default) to All so .htaccess will works.

Now you need the ~/public_html folder for each user. (to get the root page of each user as

http://localhost/~yourusername/. Unremark this line:

Include conf/extra/httpd-userdir.conf

Now as root you need to create the ~/public_html for each user and change the access to (755) of each one.

chmod 755 /home

chmod 755 /home/username

chmod 755 /home/username/public_html

You can comment out this line if you want to use SSL:

LoadModule ssl_module modules/

If you need to use virtual domains, uncomment the line:

Include conf/extra/httpd-vhosts.conf

and in /etc/httpd/conf/extra/httpd-vhosts.conf you must to add all the virtual domains. (plus into /etc/hosts

if you want to test those virtuals domains)

Edit /etc/httpd/conf/extra/httpd-default.conf and change ServerSignature to Off and ServerToken to Prod for hiding critical data 


Edit: /etc/httpd/conf/httpd.conf

Comment out: LoadModule mpm_event_module modules/

Uncomment: LoadModule mpm_prefork_module modules/

As last item in the LoadModule list, add LoadModule php7_module modules/

As last item in the include list, add Include conf/extra/php7_module.conf

Edit /etc/php/php.ini

Uncomment and

Change the timezone as you need, for example:

date.timezone = America/Argentina/Buenos_Aires, date.default_latitude = 0.0, date.default_longitude= 0.0


Run as root:

mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Now you have the root of the MySQL Server.

Start MySQL daemon:

systemctl enable mysqld

systemctl start mysqld

At last, run:

sh /usr/bin/mysql_secure_installation

That all to get a web server ready to be customized as you need.

Installing LAMP on Ubuntu

Install apache:
sudo apt-get install apache2
Install MySql:
sudo apt-get install mysql-server
Install PHP:
sudo apt-get install php5 libapache2-mod-php5
Restart system:
sudo systemctl restart apache2
Check PHP installation:
php -r 'echo "\n\nYour PHP installation is working fine.\n\n\n";'

Installing LAMP stack on CentoOS 

Install Apache Web Server
First step is to install web server Apache.
sudo yum -y install httpd
Once it is installed, enable (to run on startup) and start Apache web server service.
sudo systemctl enable --now httpd
Point your browser to:
You will see the default Apache web server page.
Install MariaDB Server
Second step is to install MariaDB:
sudo yum -y install mariadb-server

Then start and enable (on startup) the MariaDB server:

sudo systemctl enable --now mariadb

As needed, use mysql_secure_installation to secure your database.

This script will allow you to do the following:

Change the root user's password

Remove test databases

Disable remote access

Install PHP

sudo yum -y install php php-common

Then restart Apache's httpd service.

sudo systemctl restart httpd

To test PHP, create a file called index.php in /var/www/html.

Then add the following line to the file:

Then point your browser to:


You should see information related to your server. If you do not, ensure that php is for sure installed correctly by running the following command:

php --version

If you receive something like:

PHP 5.4.16 (cli) (built: Nov 6 2016 00:29:02) Copyright (c) 1997-2013 The PHP Group

Then PHP is installed correctly. If this is the case, please ensure that you've restarted your web server. 

Winter 10 Days bootcamp classes(7 HRS Daily) will start from 5 & 20 December 2019 in:
1) Internet of things(IoT) Using RASPBERRY-PI
2) Machine Learning (ML)

70% OFF| Fee-INR 3,000/-

Limited seats!! Hurry up!!

[[ CALL - 07976731765 ]]

Some Study Resources are compiled from original Stack Overflow Documentation, the content is developed by the different experts at Stack Overflow. Study resources are released under Creative Commons BY-SA. Images may be copyright of their respective owners. This website is for self-learning and not affiliated with Stack Overflow. All trademarks and registered trademarks are the property of their respective company owners. Please send feedback and corrections to