Open In App
Related Articles

Difference between LAMP stack and LEMP stack?

Like Article
Save Article
Report issue

Difference between LAMP and LEMP stack :
A Web Stack or Web application stack refers to a compilation of software that is together used to build websites or web applications.

To construct a stack basic requirements are :

  • Operating System
  • Webserver
  • Database
  • Script Interpreter

1. LAMP Stack :
LAMP stack is a collection of Linux OS, Apache Server, MySQL Database, PHP. LAMP is basically a collection of software that you require to create a dynamic web application. LAMP is free and open-source.

  • Linux – 
    An open-source operating system. Has been around since the 1990s. It is one of the most secure and reliable OS available.
  • Apache – 
    This is a free, cross-platform, and open-source web server. Apache Web Server became the most popular web server after its development worldwide. It uses protocols like HTTP or HTTPS which are the most important protocols on the internet for communication between server and client.
  • MySQL –
    MySQL is an SQL-based database based on the relational model. In a relational model, data is stored in tabular form and is ideal for both large or small-scale applications. You can create, modify or maintain your data in databases with the query.
  • PHP – 
    A server-side scripting language that communicates with server and database. PHP with MySQL is a powerful combination. PHP is used in back-end web development and also for Object-oriented programming.

As LAMP is the most popular stack the biggest advantage of LAMP is its community support, so any problem you might face as a developer someone might have already faced it and has its solution.

Working of LAMP Stack – 

  1. Apache : Web Server – 
    This is the most used and most mature web server in the world right now. It processes user requests and responds to users with web assets. If the request is for a PHP file it passes it to PHP.
  2. PHP : Scripting Language – 
    PHP as mentioned is a server-side language which according to user request communicates with the database and presents apache with a result which in turn responds according to the request and code logic written.
  3. MySQL : Database – 
    All user data is stored, updated and fetched from here. Php communicates with My SQL and fetches or inserts data according to the user request.
  4. Linux : Operating System – 
    The most secure and reliable operating system. All of the architecture mentioned above is possible because of an operating system running on the base of this architecture in a server.

2. LEMP Stack :
LEMP stack is a collection of Linux OS, Nginx Server, MySQL Database, PHP. LEMP is also open-source and is used to create dynamic web applications.

  • Linux – 
    An open-source operating system. The webserver runs on an operating system in LEMP’s case it is Linux.
  • Nginx – 
    It is pronounced as “Engine X”. It is a web server that was released in the year 2004. Nginx is now more popular than Apache (though Apache is more used worldwide). Plus it has better security with less codebase as compared to Apache and is faster than apache in some cases.
  • MySQL – 
    MySQL is an SQL-based database based on the relational model. As discussed above.
  • PHP –  
    A server-side scripting language that communicates with server and database. Similar works with all other components of the stack as in LAMP.

Working of LEMP Stack –

  1. Nginx : Webserver – 
    Similar work what Apache does in LAMP stack Nginx does for LEMP, processing the user requests and responding with suitable output.
  2. PHP : Scripting Language – 
    Processing request, communicating with the database, user authentication, etc.
  3. MySQL : Database – 
    Similar work as in LAMP stack.
  4. Linux : Operating System – 
    Linux runs at the base of this stack.

Difference between LAMP and LEMP stack:

Sl No-

LEMP Stack

LAMP Stack

1.Uses Nginx as the webserver.Uses Apache as the webserver.
2.Nginx follows an event-driven approach.Apache follows a process-driven approach.
3.Handles higher load of request betterCan slow down under heavy load.
4.Nginx handles multiple requests within one thread.Apache creates a new thread for every request.
5.Nginx doesn’t allow additional configuration.Apache allows additional configuration via a .htaccess file. 
6.The better use case for static websitesThe better use case for dynamic websites
7.Scalability is user friendlyNot as scalable as Nginx.
8.Faster and lightweightMore features, functionalities and more application modules than Nginx.

Last Updated : 12 Apr, 2022
Like Article
Save Article
Share your thoughts in the comments
Similar Reads