A WordPress LAMP?! An Introduction to WordPress Infrastructure

This article introduces one of the most foundation topics in WordPress development: the server-side software that makes WordPress work. Often referred to as “the stack,” as this article explains the “LAMP stack” that most WordPress sites run on is just an initalism of the software packages of Linux, Apache, MySQL, and PHP. And that stack is just as useful today as it was 15 years ago when WordPress started.

This content is great, because it’s not just one of our normal articles: It’s a sample chapter from our “learn WordPress development” guide Up and Running. It’s truly a great way to get started on WordPress development.

If you like this chapter, check out Up and Running. There’s about 40 more chapters where this one came from.

The Best Way to Learn WordPress Development

Get Up and Running Today!

Up and Running is our complete "learn WordPress development" course. Now in its updated and expanded Third Edition, it's helped hundreds of happy buyers learn WordPress development the fast, smart, and thorough way.

Here's what one of them had to say:

"I think anyone interested in learning WordPress development NEEDS this course. Watching the videos was like a bunch of lights being turned on." -Jason, WordPress developer

Key Takeaways:

  • WordPress sites’ most common software infrastructure is called the LAMP stack: Linux, Apache, MySQL, and PHP.
  • Linux is the operating system on which most web servers (the computers that store websites) run. However, servers can run on other operating systems, such as Windows or Mac OS, making “WAMP” and “MAMP” common configurations for people who create servers on their own computers to do local development.
  • Apache is the most common HTTP web server software. Server software allows servers to process and respond to requests for information (“HTTP requests”) sent by remote computers, making the interactivity of the internet possible. Nginx is an increasingly popular alternative to Apache.
  • MySQL refers to the structure of WordPress databases. Every WordPress site has a database, which stores and communicates crucial things like post and page contents, site settings, and users and user permissions.
  • PHP is the main language in which WordPress itself, as well as WordPress themes and plugins, are written. PHP is a server-side language, interpreted by web servers; in a WordPress site, most PHP goes through extensive processing in order to generate a given page’s HTML content, which the server then delivers to the user’s browser for rendering.

Here, we’ll look at how WordPress actually presents pages to the Internet. Our goal is to get a basic understanding of the infrastructure that underlies your WordPress site.

What is the LAMP Stack?

LAMP is an initialism that stands for: Linux, Apache, MySQL, and (in this case) PHP. Let’s explain each of those individually. We’ll go in reverse order, since it’s actually easier to understand that way.

Using PHP as a Part of the LAMP Stack

PHP is necessary for WordPress. The computer that’ll host your WordPress site simply has to be able to parse and execute PHP code. If it can’t, you don’t get to run WordPress.

PHP isn’t the only P-language that can be used in a LAMP stack. Initially (in the 1990s, when this whole thing was new) it commonly stood for Perl, and also sometimes for Python. For our purposes, though, the “P” means a server that runs PHP—the main language of WordPress themes, plugins, and WordPress itself.

MySQL as Your Database

WordPress needs a place to store data. For this it uses a relational database management system (RDBMS) solution called MySQL.

MySQL was the first, and is still the most popular, free software RDBMS solution. It remains the go-to for many types of applications, for both practical and historical reasons.

When you create a new post in WordPress, it goes into the database. When you save a new option in your site (for example, the email address that site updates should be sent to), that goes into the database, and so on. The database in all these cases is a MySQL database.

Apache: Taking Care of Web Stuff

Apache is HTTP web server software. To oversimplify its job: Apache receives requests from other computers—sent using the standardized “handshake” that is HyperText Transfer Protocol (HTTP)—and delivers back HTTP responses of its own. When you enter a URL into your browser, server software is what interprets that request, and hunts for and gives you back the right resource.

For a long long time, Apache was the only web server software that anyone used or cared about. That’s changed in the last few years, but it’s still the biggest, and it’s what your WordPress site is likely being served with. (Nginx is the Apache-alternative most clearly growing in popularity. So some people are proud to run their sites on a “LEMP” (the phantom “E” on “(E)ngine-X” being used to make the word pronounceable) stack.

By far the most common way a WordPress developer will interact directly with Apache is through an Apache-only file called .htaccess, which can be used, for example, to redirect one URL on your site to another. Other than that, Apache is “in the background” for most WordPress programming tasks. If Nginx is used, .htaccess files will have no effect. But other than that, the rest of WordPress stack will be the same.

Linux: The Operating System under Everything

Linux is an operating system, like Apple’s Mac OS or Microsoft’s Windows. Linux is the most popular Unix-like operating system, and it’s the most common operating system on servers because of its free licensing.

The specifics of what “Unix-like” means, what an operating system is, and so forth aren’t that important. What you actually need to know is simply that the other three pieces of the stack—your (Apache) web server, your (MySQL) database, and your programming language (PHP)—ride atop the operating system. And if those three work, WordPress works.

By the way, Linux is the most commonly substituted piece of the WordPress LAMP stack: If you’ve ever heard people mention developing WordPress sites locally (on their own computers) using “WAMP” or “MAMP,” that’s how: Windows and Mac OS work fine as server operating systems. Assuming everything else is in order, you can run WordPress on a server with any OS, and that’s what people who create private servers on their own Macs or PCs are doing.

What It All Means

For most WordPress development uses, every piece of the LAMP stack except PHP runs unobtrusively in the background. Still, it’s very good to know a bit about the technologies that underlie and power WordPress. We hope this quick tour gives you the basis you need to learn and explore more.

Summary Limerick

Linux, Apache, MySQL,
And PHP may have no equal.
Call them “LAMP” and you
Find folks understand you.
(At least, just about any geek will.)

Quiz Time!

  1. Apache is:
    1. An operating system
    2. A server-side programming language
    3. Web server software
  2. Which of the following is most commonly substituted in the WordPress LAMP stack:
    1. Linux
    2. MySQL
    3. PHP
  3. In WordPress, which of these things is stored in a MySQL database:
    1. Theme files
    2. Post content
    3. CSS stylesheets

Answers and Explanations

  1. C. Apache is server software: it runs on an operating system (like Linux) and provides the software infastructure for server-side programming languages (like PHP).
  2. A. Linux, an operating system, isn’t as essential to WordPress as PHP or MySQL are.
  3. B. The post content that WordPress manages lives in the database. Files, such as theme files or CSS stylesheets, do not.

Image credit: artdecodude