Web stacks have evolved over decades with advancements in technology and backend languages. Two of the most popular web stacks currently are LAMP and MEAN. They rely on two different technologies for backend languages, databases, and server environments. The "stack" term refers to technologies that stack on top of each other in order to create a web server environment.
In this article, I’d like to clarify these two web stacks by looking at their technology choices, both pros and cons. Where does each stack excel? And what types of projects would benefit the most from either option? If you’re new to web technologies or just want to learn about these two stacks, then this guide has everything you’ll need.
Traditional LAMP Development
Most developers should know about the traditional LAMP stack because it’s been around since the early web. LAMP stands for Linux, Apache, MySQL and PHP. Each of these are individual software packs that are combined to form a versatile server solution.
The biggest reason to stick with LAMP is security and widespread support. It has been around for decades, and it’s a proven method of hosting websites.
All the backend tech like PHP and MySQL are well known, and supported by every major hosting provider. If you work on a LAMP stack you can basically host anywhere. Additionally, you get access to the most popular CMS engines. WordPress, Drupal, and Joomla all run on PHP/MySQL.
However all the core software – including Apache, MySQL, and PHP – were open-sourced, and made primarily for Linux. This is why Linux makes the most sense for a server environment, and that’s why LAMP has stood the test of time for modern web development.
Most developers go this route because it’s the simplest way of getting a website online. You’ll find lots of support on forums that cover everything you need to configure and troubleshoot a LAMP environment. For instance, you can check out this ServerFault question for more info.
MEAN stands for MongoDB, Express.js, Angular.js, and of course Node.js. This acronym places no requirement for a server operating system or server software. A MEAN stack can run on any OS, and Node even comes with its own server to handle JS on the backend.
You’ll find lots of documentation and support on the Mean.io website.
Although this stack has gained lots of attention, it still has nowhere near the amount of stable support as a traditional LAMP stack.
Plus many other JS frameworks are hitting the market as stable solutions. For example, MEAN can be switched over to a MEEN stack replacing Angular with Ember.
Here are some beginners’ tutorials to get you started.
- An Absolute Beginner’s Guide to Node.js
- Felix’s Node.js Beginners Guide
- Introduction to Express.js
- Learn to Build Modern Web Apps with MEAN
- Getting Started With Node.js, Express, and MongoDB
PHP vs. Node
PHP has been around since the mid-90s, and is truly the most popular backend language. Many web developers start with (or eventually learn) PHP because it’s so predominant across web platforms and hosting providers.
Node is a newer framework but its popularity has risen extraordinarily fast. This includes the popularity of NPM as a package manager for web developers, and expands further into powerful frontend frameworks such as Angular 2.
Many developers feel that PHP is a poorly-designed language because the creator, Rasmus Lerdorf didn’t actually design it as a language. PHP started as a generic solution for websites, and quickly grew into a big library of unrelated functions.
But with PHP 7 attempting to fix many errors of the language, and with free OOP frameworks, such as Laravel, PHP is a much better language now than it’s ever been.
If you already know PHP, and want to stick with what you know, LAMP is a viable route as well.
Overall Pros & Cons:
There are multiple layers of each web stack to compare, including operating system, server software, database, and backend language.
(1) The MEAN stack also includes Angular which is a frontend framework. There isn’t any required framework in a LAMP stack, but you can always add your own to any app you build.
(2) With regards to OS, the LAMP stack looks for a derivative of Linux. Linux is typically the best choice for a server environment regardless of stack, and it’s true of MEAN as well.
(3) Now the server’s OS is just the computer software, but it’s not the web server software. To get this you need a program like Apache or nginx. LAMP uses Apache because it’s one of the most stable choices available.
(4) MEAN uses the Node.js server which is part of the Node package. It’s still fairly new, and while there is plenty of support out there, Node has nowhere near the same size community as Apache.
(6) Database management is where you’ll find the largest difference. LAMP uses MySQL for relational data storage, while MEAN uses MongoDB which is a non-relational database. Non-relational DBs are much faster, and provide an easier method of scaling with higher traffic.
(7) Keep in mind that PHP isn’t limited solely to MySQL. It can use MongoDB and other alternatives like PostgreSQL or SQLite. It’s just that most PHP developers know MySQL, so it’s the main contender for a typical LAMP stack.
(8) MEAN stacks typically run faster and scale larger, but require a lot more time and server knowledge to learn the system. LAMP stacks are tried-and-true, and they come out-of-the-box with the most secure infrastructure and the widest support imaginable.
(9) Programming languages make a major difference between the two stacks. LAMP primarily works on PHP which includes WordPress and the Laravel framework. MEAN works on ExpressJS/NodeJS for the backend with AngularJS on the frontend.
Please check out this comparison guide to learn a little more. Neither choice is right or wrong, just different and made for different projects.
I’d say most websites lean towards the LAMP stack because it’s tested, and has lots of helpful Q&A threads indexed in Google. MEAN is still growing and also has plenty of support, but may be more technical than most people want to deal with.
Feel free to try both, and see them for yourself. It’s possible to install both setups locally on your computer, and build on them without a remote server.
And if you’re looking for more info on either stack, I’ve collected a set of handy links below.
- Learn to Build Modern Web Apps with MEAN (thinkster.io)
- Docker LAMP Stack Admin (jessesnet.com)
- How To Install Linux, Apache, MySQL, PHP (LAMP) Stack on Debian 8 (digitalocean.com)