LAMP (Linux, Apache, MySQL, and PHP) Stack

What is a LAMP stack?

You might have read something about the stack at LAMP. That wouldn’t be shocking, as some of today’s most popular open source web applications–such as WordPress and Drupal–run on LAMP.

Yet LAMP has much more to credit for. It was one of the web’s first open source software stacks, and remains one of the most common ways of distributing web apps. It’s so commonly used that you’ll likely find it during your career when you upgrade or host existing applications. And many found it the platform of choice to develop new, custom web applications.

Stable, quick, strong-these are the most frequently used words to describe LAMP. All of this makes learning worthwhile and a valuable addition to any developer’s CV.

Components

LAMP symbolizes Linux, Apache, MySQL, and PHP. Together, they provide a validated collection of web applications providing high-performance apps. Every part contributes critical functionality to the stack:

Linux: The current operating system. Linux is an open source, free operating system (OS) that has existed since the mid-1990s. Today, it has a broad global user base, reaching across industries. Linux is partly common, as it offers more versatility and configuration than some other operating systems.

Apache: The server on the site. The Apache web server handles requests and serves web assets through HTTP so that the application can be accessed through a simple Web URL to anyone in the public domain. Developed and maintained by an open community, Apache is a mature, feature-rich server that currently runs a large proportion of the websites on the Internet.

MySQL: The basis of that database. MySQL is an open source relational database management system designed to store data from applications. For My SQL, you can store all your information in a format that the SQL language is easily queried to. SQL is a great choice when you’re dealing with a well-structured business domain and want to convert the framework into the backend. MySQL can run even large and complex sites.

PHP: The language used for programming. Apache works with the PHP open source scripting language to help you create dynamic web pages. You can not use HTML to do complex processes such as removing data from a database. You simply drop PHP code into the sections of a page that you want to be dynamic to provide this form of functionality.

PHP is for performance. It makes programming easier — and a little more fun — by allowing you to write new code, hit refresh, and see the resulting changes immediately without having to compile. You can swap PHP for Perl or the increasingly popular Python language, if you prefer.

LAMP has a classic layered architecture, with lowest level Linux. The next layer is Apache, followed by PHP, and MySQL. While PHP is nominally in the top or layer of presentation, the PHP portion is inside Apache.

How the elements work together

A high-level view of the execution order of the LAMP stack reveals how the components interoperate. The process begins when a user’s browser receives requests for web pages from the Apache Web server. If the request is for a PHP script, Apache will forward the request to PHP, which loads the file and executes the code in the file. PHP also interacts with MySQL to retrieve any information referenced in the code.

To build the HTML that browsers use to view web pages, PHP instead uses the code in the file and the database details. The LAMP stack manages not only static web pages but also dynamic pages where the content will change depending on the date, time, user identity and other factors each time it is load.

PHP then transfers the resulting data back to the Apache web server to return it to the user after executing the file code. It can store the new data in MySQL as well. And of course the Linux operating system running at the base of the stack allows all these operations.

Flexibility

While LAMP uses Linux as the OS, the other components with an alternate OS can be use to suit the specific needs. There is a WAMP stack, for example, that uses Microsoft Windows; MAMP for Mac OS; and even WIMP, using Microsoft’s Windows and Internet Information Services webserver.

You will prevent lock-in because LAMP is all open source and non-proprietary. You have the freedom to choose the right parts for specific projects or business needs.

In other respects, LAMP provides versatility too. Apache is modular in nature and you’ll find current, customizable modules for many different extensions available. Such modules vary from other language support to the authentication capabilities.

Another advantage of LAMP is its stable architecture and well-establish encryption methods, which the company has demonstrate.

Efficiency

LAMP will help you reduce the time needed for growth. Since LAMP is an open source platform that has been available for over a decade, today there is a strong LAMP ecosystem. You should draw on, and make your own, what other people have done in the past. Function within an Apache module that gives you 80% of the way, customizes the last 20%, and as a result saves considerable time.

LAMP(Linux, Apache, MySQL, and PHP)
LAMP(Linux, Apache, MySQL, and PHP)