What is a LAMP stack?

LAMP stack software

In the simplest terms, a LAMP stack is a web server running a Linux operating system. More specifically, LAMP refers to the primary traditional components of such a web server:

  • Linux
  • Apache
  • MySQL
  • PHP

Requests arrive across the internet where a Linux operating system supports an Apache HTTP server installation that can interpret, understand, and respond to those requests. PHP scripts can access information stored in the MySQL database(s), perform functions on that data as needed, and return the output back to the user who originally requested it via the web.

Let’s take a deeper look at each component, what it does, and why it’s essential to serving up dynamic, modern websites:

Linux Server (Operating System)

The first layer of software on any computer system is the operating system (OS). The OS provides the most basic and fundamental instructions for the hardware, such as scheduling processor tasks, managing the file system, and controlling peripheral devices.

Linux Server is a popular choice because it contains just what you need to run a computer as a server. While there are some more user-friendly versions of the popular Linux distributions that include graphical UI desktops, the server version is probably the one you’ll want for a LAMP. Popular distributions include Ubuntu Server, CentOS, Debian, Red Hat, and many more! For most novice Linux users, the differences between these major distributions won’t be particularly noticeable, so don’t worry too much about which one you pick. I got started with Ubuntu as a matter of chance, and I’ve stuck with it since – mostly out of habit.

So pick a server distribution, download the ISO, and format some bootable media. In a few minutes, you’ll have a Linux machine that’s ready to become a web server.

Apache (HTTP Server)

Since the point of a LAMP stack is to respond to and serve web requests, the next most essential piece of the system will be the HTTP server itself. Apache is the popular choice that gives a LAMP part of its name, but it’s not even the only choice out there. Nginx is gaining in popularity and most systems that are using Apache these days are actually using Apache2, Apache LightFoot, or one of the many variations that have been built up around it in the last few years.

When you configure the Apache server, you’ll tell it where to send traffic for each domain requested. A file at example.com/index.html might point to a file located at /srv/www/example.com/public_html/index.html and Apache will help translate that. It will also keep track of exactly who requested exactly what, and then serve those results as output once they’re ready. If the server gets bogged down with requests, Apache will also be tasked with trying to remember where each request was in line, and returning the result even if a significant amount of time has passed since the request was initially made.

MySQL (Database)

Apache can route requests to the appropriate locations within the server, and it can organize who is waiting for what output, but it isn’t the data or the system itself. For storing large amounts of data and information, we’ll be using MySQL database.

Why MySQL? Well, it’s an incredibly popular variation of the even more ubiquitous SQL system, and it’s popular because it’s free, open source, and easy to learn. It’s also the default database system for a lot of popular content management systems like WordPress, Drupal, Joomla, vBulletin, and more.

MySQL is a relational database, so it consists of two or more tables that each have one or more columns and/or rows. There are some efficiency gains that can be had from non-relational databases, but that’s an issue at a much higher level of scale than we’re dealing with right now. MySQL provides a simple and free to use entry point for database servers, so it’s a perfect fit in a LAMP.

PHP (Scripting language)

While the data you want to serve may be stored safely in the MySQL database you’ve created for it, Apache can’t just go request it directly. What Apache can do is run a script that fetches and/or processes that data as needed, so that’s where PHP or another scripting language comes in.

PHP is popular because, like MySQL and Apache, it is free to use and fully open source. This means you can dabble without making a commitment, or you can specialize and take it all the way to the source code. It’s great for beginners and experts alike, although it is facing increased competition from Python and some other new codebases.

Anyway, PHP allows you to set up scripts and programs that interact with databases and outputs HTML code. Again, that’s perfect for a web server because users will be expected that database information in an HTML format that their browsers can format properly. PHP can also perform various functions on the data – or user’s input – so it allows creation of quite a wide array of web apps. Facebook and WordPress are both built out of PHP (although it is far from being the only code language in use at Facebook these days!)

Why LAMP? Or why not?

Pros:  If you need a cheap, light weight web server, LAMP is the way to go. You can build your own out of an old PC in an afternoon, or you can rent one from a place like Linode starting at just a few bucks a month.

Cons: If you have a huge traffic load, you might need to consider a more personalized server structure. LAMP stacks can struggle with numerous requests coming in. Also: some server and web applications will require a Windows hosting environment.

 

(Full disclosure, I am a customer and affiliate of Linode and any purchases made through these referral links will be credited to my account to help pay for my own LAMP hosting!)

 

Summary
Aggregate Rating
5 based on 2 votes
Software Name
LAMP
Operating System
Linux
Software Category
Web server
Price
USD $0

Be the first to comment

Leave a Reply

Your email address will not be published.


*