Many people in the IT World are familiar with the acronym LAMP. It’s become synonymous with the PHP frameworks Laravel and Symfony, which have both gained increasing popularity in the last few years as powerhouses for websites across the world. But did you know there’s an alternative to LAMP known as LEMP? So, LEMP or LAMP, which should you choose? Let’s take a look.
What is a LAMP stack?
LAMP stands for Linux, Apache, MySQL and PHP. ‘LAMP stack’ simply refers to this set of technologies that are used to build and develop websites and web-based applications.
What is a LEMP stack?
LEMP stands for Linux, Nginx, MySQL and PHP. ‘Ngnix’ is pronounced ‘Engine-X’, which is where the ‘e’ in LEMP comes from.
What’s the difference between LAMP stack and LEMP stack?
There are several key differences between LAMP stack and LEMP stack:
LAMP Stack | LEMP Stack |
---|---|
Uses Apache web server | Uses Nginx web server |
Process-driven approach | Event-driven approach |
Slows under heavy load | Handles higher load of requests |
Creates new thread for each request | Handles multiple requests within a single thread |
Apache does accept additional configuration | Nginx doesn’t accept additional configuration |
Better use case for dynamic sites | Better use case for static websites |
Not as scalable | User-friendly scalability |
More features and functionality | Faster and lightweight |
Table adapted from: https://www.geeksforgeeks.org/difference-between-lamp-stack-and-lemp-stack/
Nginx vs Apache
Nginx is an alternative HTTP/HTTPS web server that tends to be lighter weight and historically more performant than Apache. More recently, the performance of the two servers has narrowed, but that doesn’t eradicate any potential benefits and drawbacks to each of the software. Depending on the PHP web application or framework in use, you may find better throughput from one or the other.
There are very few people who wouldn’t agree that Nginx is far more efficient at serving static content than Apache. However, the waters get muddied when serving dynamic content comes into play. This could be PHP, Python or any of the other multitude scripting languages that are used on the back-end to generate web content, but for the purposes of this article, we’re concentrating on PHP.
If your server is handling a single dynamic site, then it’s likely that Nginx will offer better throughput and scale better than Apache. Alternatively, if you’re hosting multiple dynamic sites, then the performance difference between the web servers is almost immaterial, as PHP itself will likely become the bottleneck to site delivery.
To put it simply, Apache has countless options, but you only need a handful of them. Nginx can cover those essentials, and it does the majority of them much faster than Apache.
LAMP stack vs LEMP stack: what’s the right choice?
For new sites or servers, both Apache and Nginx are powerful web servers. Therefore, choosing whether to use LEMP or LAMP is dependent on many factors, but we recommend the following:
- For a fast and lightweight server for a single site, choose LEMP/NGINX
- To host multiple sites or if you require specific additional functionality on the web server software, choose LAMP/Apache
For existing servers, the likelihood is that optimising PHP and adding the likes of APC or similar opcode cache is likely to speed things up far more than switching web server software and with far less upheaval.
If you’re unsure whether LEMP or LAMP is the right choice for you, call us now for a free consultation.
<< Back to Knowledge Centre