You may have heard something about the LAMP stack. That wouldn’t be surprising, since some of today’s most popular open source web applications — for example, WordPress and Drupal — run on LAMP.
But LAMP has a lot more to its credit. It was one of the first open source software stacks for the web and remains one of the most common ways to deliver web applications. It is so widely used that you are likely to encounter it frequently during your career as you update or host existing applications. And it is considered by many to be the platform of choice for developing new custom web apps.
Stable, simple, powerful—these are words most often used to describe LAMP. All of this makes it well worth learning about and a valuable addition to any developer’s resume.
LAMP stands for Linux, Apache, MySQL, and PHP. Together, they provide a proven set of software for delivering high-performance web applications. Each component contributes essential capabilities to the stack:
PHP is designed for efficiency. It makes programming easier—and a bit more fun—by allowing you to write new code, hit refresh, and immediately see the resulting changes without the need for compiling. If you prefer, you can swap out PHP in favor of Perl or the increasingly popular Python language.
LAMP has a classic layered architecture, with Linux at the lowest level. The next layer is Apache and MySQL, followed by PHP. Although PHP is nominally at the top or presentation layer, the PHP component sits inside Apache.
A high-level look at the LAMP stack order of execution shows how the elements interoperate. The process starts when the Apache web server receives requests for web pages from a user’s browser. If the request is for a PHP file, Apache passes the request to PHP, which loads the file and executes the code contained in the file. PHP also communicates with MySQL to fetch any data referenced in the code.
PHP then uses the code in the file and the data from the database to create the HTML that browsers require to display web pages. The LAMP stack is efficient at handling not only static web pages, but also dynamic pages where the content may change each time it is loaded depending on the date, time, user identity and other factors.
After running the file code, PHP then passes the resulting data back to the Apache web server to send to the browser. It can also store this new data in MySQL. And of course, all of these operations are enabled by the Linux operating system running at the base of the stack.
Although LAMP uses Linux as the OS, you can use the other components with an alternative OS to meet your specific needs. For example, there is a WAMP stack, which uses Microsoft Windows; MAMP with the Mac OS; and even WIMP, using Windows and the Internet Information Services webserver from Microsoft.
Because LAMP is all open source and non-proprietary, you can avoid lock-in. You have the flexibility to select the right components for specific projects or business requirements.
LAMP offers flexibility in other ways as well. Apache is modular in design, and you will find there are existing, customizable modules available for many different extensions. These modules range from support for other languages to authentication capabilities.
Another advantage of LAMP is its secure architecture and well-established encryption practices that have been proven in the enterprise.
LAMP can help you reduce development time. Because LAMP is an open source stack that has been available for more than a decade, there is today a substantial LAMP ecosystem. You can build on what other people have done in the past and make it your own. Work within an Apache module that gets you 80% of the way there, customize the last 20%, and save considerable time as a result.
Technology can become complex, obscuring the basic workings of the software. A LAMP stack gets back to basics, taking you a little closer to the technical serving of web pages and how that is done. You might also say it’s a pure way to create an application. You have your database, your scripting language, and a way to serve it to clients—that’s LAMP.