What is LAMP Stack
The LAMP stack is the foundation for Linux hosted websites is the Linux, Apache, MySQL and PHP (LAMP) software stack.
The Four Layers of a LAMP Stack
Linux based web servers consist of four software components. These components, arranged in layers supporting one another, make up the software stack. Websites and Web Applications run on top of this underlying stack. The common software components that make up a traditional LAMP stack are:
Linux: The operating system (OS) makes up our first layer. Linux sets the foundation for the stack model. All other layers run on top of this layer.
Apache: The second layer consists of web server software, typically Apache Web Server. This layer resides on top of the Linux layer. Web servers are responsible for translating from web browsers to their correct website.
MySQL: Our third layer is where databases live. MySQL stores details that can be queried by scripting to construct a website. MySQL usually sits on top of the Linux layer alongside Apache/layer 2. In high end configurations, MySQL can be off loaded to a separate host server.
PHP: Sitting on top of them all is our fourth and final layer. The scripting layer consists of PHP and/or other similar web programming languages. Websites and Web Applications run within this layer.
We can visualize the LAMP stack like so:
Applying what you’ve learned
Understanding the four software layers of a LAMP stack aids the troubleshooting process. It allows us to see how each layer relies on one another. For instance; when a disk drive gets full, which is a Linux layer issue. This will also affect all other layers in the model. This is because those other layers rest on top of the affected layer. Likewise, when the MySQL database goes offline. We can expect to see PHP related problems due to their relationship. When we know which layer is exhibiting problems. We know which configuration files to examine for solutions.