If you’re unfamiliar with the term LAMP stack, be assured it’s quite different from a stack of lamps. A stack in this sense is a technology stack or solution stack. It is a list of all the major components used to form a complete technology solution. The Lamp stack is probably the most common stack used for hosting web sites and web applications, especially among small- to medium-sized sites.
LAMP is an acronym that stands for four major components: Linux, Apache, MySQL, and PHP.
Each of these components is open source and free to use, which has contributed to their popularity.
Let’s look at how a typical web request works to see what each component does. A visitor to a website will enter a web address in a browser that will send a request to a web server. That web server will execute some code that generates an HTML file and sends it back to the visitor’s browser. All the LAMP components are installed and running on the web server. A server is a type of computer, and it needs an operating system.
L for Linux
L stands for Linux, which is the operating system in a stack. You probably have Microsoft Windows or Apple’s Mac OS running on your desktop computer, but Linux is incredibly popular for servers. The operating system provides a base foundation on which all the other components can run.
A for Apache
The A stands for Apache, which is the web server software that receives and handles all those requests from visitors. If someone requests index that is HTML or JPEG, Apache looks on the server for the file and sends it back to the visitor’s browser.
P for PHP
The P usually stands for PHP. It could also stand for Python, though this is not as common. PHP is a programming language for generating dynamic web pages. When a visitor request a PHP file, Apache won’t just get that file and send it back to the browser like it does with HTML files or images. Instead, it gives the file to PHP first. PHP executes the code in that file and generates the HTML for the webpage. The HTML generated by PHP goes back to Apache and then back to the visitor’s browser.
M for MySQL
The M stands for MySQL. This is a database engine used for storing a site’s data. Often the data needed to generate a PHP file depends on who the visitor is; like their name, account number, or order history. A database allows that data to persist over time. PHP retrieves that data from the database, uses it to generate the HTML for that page, and that then get sent by Apache back to the visitor’s browser.
The LAMP stack is one of the more popular stacks for building web sites and web applications, but it’s, of course, not the only one. You should now have a good idea what the LAMP stack is and what all of its components do, and you shouldn’t have any trouble distinguishing it from one of the other stacks.