What is LAMP?
LAMP is the bundled software infrastructure which has come to dominate the server environment of the World Wide Web. The acronym has some variance:
- “L” stands for the Linux operating system
- “A” stands for the Apache server
- “M” stands for the MySQL database system
- “P” usually stands for the PHP programming language, but sometimes also the programming languages Perl, Python, or CGI scripting in general.
Taken together, this elegant ecosystem forms the guts of a website. From this software system installed on a server-capable computer, web pages are served to visitors, with a great deal of activity happening in the background.
The days are gone when you could serve plain HTML pages cobbled together in something like Microsoft FrontPage. The web of the 21st century is dynamic, with changing content updating regularly. Blogs, engines, galleries, and interactive interfaces now make up most of the web, allowing visitors to play games, watch movies, chat with others, and even produce content right in the web browser. Come to that, the web browser itself is said to be the new “operating system,” at least as far as end-user experience is concerned.
There was a long and protracted struggle between tech companies to establish dominance in the server rooms of the world, but the LAMP stack today has emerged so far ahead, second place isn’t even in the running. Since it’s the standard, you might as well get to know it intimately if you’re entering eCommerce in the 2010s.
Linux – The Base
Linux is a Free and Open Source Software (FOSS) operating system most closely modeled after the original Unix. Linux is worth a book or two on its own, but suffice it to say that it’s risen to prominence as the most popular server OS on the web. Count in the fact that Linux also sees some office and home use, and it’s pretty much taken over the world market.
Linux wins out over competitors for a number of reasons:
- Security. Its Unix-like core is still the tightest control you can get from an enterprise system.
- Flexibility. The Linux kernel is built to be customized and can run on anything from a phone to a supercomputer.
- Integration and support. The software tools that have made their home on Linux servers support Linux first.
- Licensing. Being as free as rain, one need not worry about proprietary taxes and licensing issues.
We don’t mean to say “run Linux or die” here. There are also sites that run on a Microsoft Windows Server platform, though still running Apache and some form of SQL. BSD, the Berkeley Software Distribution of Unix, spawned FreeBSD, OpenBSD, and most applicably NetBSD, which also shares many of the same benefits of Linux and can also run the rest of the LAMP stack without much worry.
But for the most part, Linux is given as the default choice, and there’s really not much reason to look elsewhere.
Apache – The Backbone
The Apache HTTP server has dominated the web even more consistently than any other component of the LAMP base. Like Linux, it is also Free and Open Source Software, maintained by a consortium of top developers working as the Apache Software Foundation. While its market popularity may shift due to market forces, and other web server platforms are gradually trying to catch up, Apache has gotten as high as 70% market share of all domains.
Apache is what programming geeks sometimes refer to as a “Swiss Army chainsaw.” It has raw power and flexibility, capable of anything you’d want a web server to do, but is sometimes not the most graceful way to solve a problem. It can be extended to work with the most popular server-side programming languages, such as PHP, Perl, Python, and Tcl. It supports dynamic modules and virtual hosting, together with security and authentication protocols.
In recent years, some other web server software systems have shown up in Apache’s rear-view mirror. NGINX, another FOSS server originated by a Russian developer, runs a distant second, often deployed in tandem with Apache to serve as a load balancer for unexpected traffic spikes. Microsoft’s own IIS (Internet Information Services) is a close third, but usually chosen to run on Windows Server. Outside of that, Apache is a stable first pick.
MySQL – The Brain
Pardon us for our labored anatomy analogy, which is destined to get clumsier as we wear on. MySQL itself isn’t exactly the lead relational database management system (RDBMS) anymore, as it’s more accurate to refer to any generic database architecture using the SQL (Structured Query Language) language. MySQL is also Free and Open Source, but has recently come under a dual proprietary license.
A website needs a database to store and retrieve data. That data can be anything from records of user accounts to individual files in a gallery to blog posts, but the point is to design the information architecture so that the data can be nimbly retrieved by many requestors. SQL queries and statements are typically made to and from the database via the source code of the website’s pages.
PHP, Perl, Python, and Others – The Face
We’ve finally reached the part of your website system that your users see the direct results of. PHP, Perl, and Python are all server-side capable scripting languages. Their purpose in life is always the same: To respond to a website visitor request or query, compose a web document or a data packet on the fly, and send it back to the user’s web browser as fast and efficiently as possible. This practice is called CGI (Common Gateway Interface).
Like the rest of the LAMP stack, the dominant scripting languages are also FOSS.
- PHP is the most dominant server-side scripting language. It is the language of choice for developing WordPress, the world’s most dominant blog software (technically called a CMS for Content Management System). Pretty much any other utility you’d find in a cPanel interface on your website’s control panel is also written in PHP.
While PHP is a pretty brutalist language, it does the job and does it with many C-like capabilities brought to a scripting environment. It has a huge community and support system. The documentation on the PHP.net site is just about the most complete reference ever made for any language.
PHP’s main downsides are being slower than some alternatives, having security issues that are show-stopping until they’re patched, and lacking general-purpose solutions. While it’s easy to maintain, it is the most verbose language, and therefore cumbersome, to code. The experience of coding PHP is often compared to building something out of mud.
- Perl used to be the dominant CGI language. It served the early days of the web up until the turn of the century. It is still deployed all over the world, as well as being a popular scripting language for applications and internal scripts. It’s headed by Larry Wall, a developer who built the Perl engine from C as a distilled Unix-like scripting environment.
While Perl is almost never used for common CMS tools, it’s still perfectly capable as a stand-in for CGI use. It has advantages over PHP in being faster, far more flexible, and having superior text-parsing capabilities, often feeling like a complete Unix system at your fingertips. Perl’s motto is “there’s more than one way to do it!”
Its downside is that it’s a pain to maintain, as the language is so flexible that ten Perl programmers can write ten scripts to do the same thing, with no two scripts bearing any resemblance between them. While it’s great for small “glue” shell-script jobs, nobody would want to build a big project in it. As the counter to its motto, detractors note that Perl is a “write-only language.”
- Python is the youngest and feistiest language on the CGI block; though it’s actually older than PHP, it only recently became a viable server scripter. Created and maintained by Guido van Rossum, Python is a member of the new generation of scripting languages intended to extend scripting capability while being easy to maintain.
Python’s strengths are easily visible when you view a page of source code. It is designed to be a breeze to learn, and enforces methods that produce uniquely readable code. It borrows many of the best ideas from other capable languages, integrated into a package that’s robust and elegant.
Its downsides are what you’d expect given the above nature: It’s slowest of all CGI languages. While the language is streamlined and powerful, your average Python script just takes more space than your average perl script. As long as you’re not trying to build anything too complex, however, it’s capable.
Other languages: The most common after the big three is ASP, Microsoft’s own server-side scripting language which is the most pushed solution on an IIS server. Ruby is popular with hip Silicon Valley jocks, as a kind of cult language with devoted fans; notably, Ruby-on-Rails is a web application framework that’s made a big splash. Rarely you’ll see obscure niche languages like TCL and Lua used.
That’s The Full LAMP Stack Tour!
Thank you for joining us on this tour of the infrastructure of the web! Even if you don’t use most of this knowledge when setting up an online business, it’s important for every web developer to know. Even for those of you who have no interest beyond paying a hosting provider and running from cPanel, LAMP stack components are inevitably going to be what you’re working with and some problems will require you to get under the hood for the occasional tweak. So it’s best to know what you’re buying yourself into!