Learn the differences between the LAMP and MEAN stacks, their benefits and their advantages for web app development.
LAMP and MEAN are popular open-source web stacks used for developing high-performance, enterprise-grade web and mobile apps. Like other web stacks, they combine technologies (operating systems, programming languages, databases, libraries and application frameworks) that developers can use to create, deploy and manage a fully functional web app efficiently and reliably via stack development.
LAMP and MEAN are different in that they provide developers with different layers — or “stacks” — of technologies that a web app needs to function across all frontend interface, network and backend server activity. For example, a web-based banking application might rely on either the LAMP stack or MEAN stack to interpret a user’s request to see banking activity, retrieve the necessary data and display it in a user interface.
What is LAMP stack?
LAMP stands for the following stacked technologies:
L: Linux (operating system)
A: Apache (web server)
M: MySQL (a relational database management system, or RDBMS, that uses SQL)
P: PHP (programming/scripting language)
The Linux OS enables the entire web app to function correctly on a given piece of hardware. The Apache web server translates a user’s request and then retrieves and “serves” information back to the user via HTTP (Hypertext Transfer Protocol). The MySQL database (a relational database management system) stores the data (e.g., bank statement archives, financial activity, image files, CSS stylesheets) that the web server can retrieve and provide based on the user’s specific request. The PHP programming language works with Apache to retrieve dynamic content from the MySQL database and present it back to the user. While HTML can display static content (e.g., a headline that remains on the interface regardless of data), dynamic content that changes based on user interaction relies on PHP. The programming languages PERL and Python can also be used in the LAMP stack. Writer Michael Kunze was the first to use the acronym LAMP stack in an article for a German computer magazine published in 1998.
Figure 1 shows a high-level example of how a web app responds across its LAMP stack when a user requests information. This request can include user actions like opening the application, logging in and performing a search function within the application:
What is MEAN stack?
MEAN stands for the following stacked technologies:
M: MongoDB (non-RDBMS NoSQL database)
E: Express.js (backend web framework)
A: AngularJS (frontend framework that builds user interfaces)
N: Node.js (open-source backend runtime environment)
The AngularJS framework processes an incoming user request. Node.js then parses the request and translates it into inputs the web app can understand. Express.js uses these translated inputs to determine what calls to make to MongoDB, a non-relational NoSQL database. Once MongoDB provides the necessary information, Express.js then sends the data back to Node.js, which in turns sends it to the AngularJS framework so it can display the requested information in the user interface.
Figure 2 shows a high-level example of how a web app responds across its MEAN stack to fulfill a user’s request for information:
What are the advantages and disadvantages of LAMP stack development?
Advantages of LAMP
The following are some benefits of using LAMP to create, deploy and manage web applications:
Widespread support and trust: Because the technologies of LAMP have existed since the 1990s and have been used in various kinds of software development, it is universally trusted and supported by the open-source community. For example, many hosting providers support PHP and MySQL.
Open-source technology: The LAMP technologies are open source, meaning they are readily available and free for developers to use. LAMP is also highly flexible due to its open-source technologies, freeing developers to use the components that make the most sense for a given web app. For example, PHP can use multiple compiler runtime engines, such as Zend or Laravel. LAMP can also use any number of open-source databases, such as PostgreSQL.
Apache: The Apache web server is regarded as reliable, fast and secure. It is also modular, making it highly customizable.
Security: The LAMP stack features enterprise-grade security architecture and encryption.
Efficiency: Using the LAMP stack can reduce app development time due to its ease of customization. For example, programmers can start with an Apache module and change the code as needed versus developing code entirely from scratch.
Scalability: Web apps built, deployed and managed using LAMP stack are highly scalable and fast to develop due to its non-blocking structure.
Low maintenance: The LAMP stack ecosystem is stable and requires little maintenance.
Comprehension: Because PHP and MySQL are relatively easy to understand, LAMP stack development is a good option for beginners.
Disadvantages of LAMP
The disadvantages of using LAMP to create, deploy and manage web applications include the following:
Limited OS support: LAMP only supports the Linux operating system and its variants, such as Oracle Linux.
Monolithic architecture: While arguably more secure than cloud, LAMP is more monolithic than cloud-based architectures (cloud architectures are more scalable and affordable and return data quicker via APIs).
What are the advantages and disadvantages of MEAN stack development?
Advantages of MEAN
The benefits of using MEAN to create, deploy and manage web applications include the following:
Real-time updates and demonstrations: The technologies in the MEAN stack make it possible to push real-time updates to deployed web apps. Developers can also quickly demonstrate the functionality of web apps in development.
Cloud compatibility: The technologies in the MEAN stack can work with the cloud-based functions found in modern web services (such as calling on an API for data retrieval).
JSON files: MEAN allows users to save documents as JSON files, which are designed for fast data exchange across networks.
Efficiency: Developers can use resources from public repositories and libraries to reduce web application development time. This makes MEAN stack development a cost-effective option that startups may find appealing.
A fast runtime environment and ease of maintenance: The Node.js runtime is fast and highly responsive while the Angular.js framework is easy to maintain and testable.
Cross-platform support: MEAN is a cross-platform stack, meaning its web applications can function on multiple operating systems.
Disadvantages of MEAN
These are some disadvantages of using MEAN to create, deploy and manage web applications:
Potential data loss: Large-scale applications may experience data loss due to MongoDB requiring excessive memory for data storage. Additionally, MongoDB does not support transactional functions.
High maintenance: The technologies in the MEAN stack are updated often, which means frequent maintenance on web apps is required.
MEAN vs LAMP: Which is better?
Neither stack is better than the other, per se. However, LAMP stack or MEAN stack may be better suited for a particular web development use case.
LAMP stack is generally the better option for web applications or sites with the following characteristics:
- Are large in scope, static (i.e., not needing real-time updates) and will experience heavy workflows with spikes in traffic
- Have a short lifespan
- Are server-side in nature
- Use a CMS such as WordPress
Conversely, MEAN stack is the better choice for web applications or sites like these:
- Take advantage of modern cloud technologies like APIs and microservices
- Have a long lifespan
- Are smaller in scope with consistently predictable traffic (decreasing the likelihood of data loss)
- Require a lot of logic on the client side
LAMP stack, MEAN stack and IBM
To get back to basics, LAMP stack takes you a little closer to the technical serving of web pages and how that is done. You have your database, your scripting language, and a way to serve it to clients — that’s LAMP.
If you want to see how easy it is to develop and deploy an application to the cloud using a LAMP or MEAN stack, IBM offers a the following tutorials:
Sign up and create your IBM Cloud account.