Support

Find answers, guides, and tutorials to supercharge your content delivery.

LAMP Stack

Published on March 10, 2021
LAMP Stack

The LAMP stack is an essential backend framework for web servers. LAMP is an acronym that describes each layer of the stack, going from the bottom up. The letters stand for:

  • Linux: At the very base of a LAMP stack is the Linux operating system of the server.
  • Apache: This is baseline server software that powers the ability for the machine to host and serve content to clients.
  • MySQL: Though users can choose whatever relational database management system they like, MySQL is what's traditionally used in a LAMP stack. This allows for the storage of data to be retrieved by web applications.
  • PHP: PHP is the final layer. This server side language allows for web apps of all layers to be written and run. PHP easily integrates directly with MySQL to enable grabbing and writing to and from MySQL database tables.

Not every LAMP stack is alike

There are some common variants of the LAMP stack, such as the WAMP stack. This variant simply substitutes Windows out for Linux as the server's operating system. Likewise, there's the MAMP stack, which swaps out Linux for macOS. Though some of the technologies, like MySQL, may seem outdated, there's a reason that the LAMP stack has remained so popular among web developers.

This stack is highly portable because all of the software is free and open source. That means that organizations and development teams don't need to pay to use them. Many variants, like the WAMP stack, are not fully open source. While these may use more modern technologies, they typically aren't as easy to move from one server to another and are more costly.

Visualizing a traditional LAMP stack

First, it's important to understand that Linux underlies every other element of the stack. At the bottom, we'd have our MySQL or other database server. This writes to and from PHP. PHP directly communicates with the Apache software; the resulting content is then ultimately delivered to the client who requested it.

The Linux layer

Every common distribution of Linux comes packed with free, open source tools. In order to make setting up your LAMP stack even easier, every major Linux operating system comes with a built-in tool to do just this. Those on Windows servers who wish to make their own WAMP stack will essentially need tools that emulate what the original LAMP stack tools for Linux do.

The Apache layer

Apache is included because it's used so frequently. It's the Internet's most utilized HTTP server; about 53% of servers online today are running Apache. The Apache Software Foundation maintains it and regularly issues patches to help sites using the software run securely.

The most common variant of this layer is to install an nginx server instead. For users just getting to learn the ropes, Apache is the best way to go. For more experienced users with more complex applications, the best server type will depend on many factors. After Apache, nginx is the second most common type of server found on the web, with approximately 15% of sites online today using it.

The MySQL layer

Oracle currently owns MySQL, but the language is still fully open source. MySQL has been around since about 2008 and has remained the most popular Relational Database Management System (RDBMS) in usage today. There are several alternatives that effectively do the same thing, such as PostgreSQL and MariaDB.

The reason MySQL is favored is because it's easy to use, it is regularly updated, and it supports multi-threaded access as well as multiple users. MariaDB is a version of MySQL that the original developers have maintained independently. Though there are key differences, it's functionally equivalent to Oracle's MySQL.

NoSQL databases

The most recent modification to the LAMP stack is the usage of non-relational database management systems. Most commonly, this is substituting MongoDB for MySQL. Though these types of databases are usually slower for writing and retrieving small bits of data, they can be faster for retrieving large loads of data. The way they store and access data as well as the types of data they can store differs greatly.

Just as a network engineer would need to assess the best server variant to use, a software engineer would need to assess which type of database would best fit with their web application.

PHP

PHP's rise to fame is largely due to how easy it is to embed into web pages, configure, run commands, and its age. Though it's still a viable programming language, it's been falling out of fashion lately. This is because its ability to create objects and re-use them is quite limited compared to its competitors.

Perl and Python are two languages that have begun to overtake PHP. Perl is more similar to PHP than Python, though it focuses more on parsing and text-file processing. Python has rapidly gained traction among developers because of its ease of use and similarity to other modern programming languages.

Creating your own LAMP stack

As you can see, while there's a model stack you can use, it's quite easy to make your own version of the stack. While you go about your web development journey, feel free to experiment with new technologies!

There's no one correct way to do things. The way everything operates is solely up to you, the architect and engineer of your product! Remember, though the acronym is LAMP, you can change it to whatever best fits.

Supercharge your content delivery 🚀

Try KeyCDN with a free 14 day trial, no credit card required.

Get started
KeyCDN uses cookies to make its website easier to use. Learn more