LAMP Stack is a set of open-source software to create websites and web applications. LAMP is an acronym, and these stacks typically consist of the Linux operating system, the Apache HTTP Server, MySQL relational database management system, and the PHP programming language.
Linux is a Unix-like computer operating system assembled under the model of free and open-source software development and distribution.
Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation. Released under the Apache License, Apache is open-source software. A wide variety of features are supported, and many of them are implemented as compiled modules which extend the core functionality of Apache. These can range from server-side programming language support to authentication schemes.
MySQL is a multithreaded, multi-user, SQL database management system (DBMS), acquired by Sun Microsystems in 2008, which was then acquired by Oracle Corporation in 2010. Since its early years, the MySQL team has made its source code available under the terms of the GNU General Public License, as well as under a variety of proprietary agreements. MariaDB is a community-developed fork of MySQL, led by its original developers.
PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. PHP code is interpreted by a web server via a PHP processor module, which generates the resulting web page. PHP commands can optionally be embedded directly into an HTML source document rather than calling an external file to process data. PHP is free software released under the terms of the PHP License, which is incompatible with the GNU General Public License (GPL) due to the restrictions PHP License places on the usage of the term PHP.
Linux based web servers consist of these 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.
PHP's role as the LAMP's application programming language has also been performed by other languages such as Perl and Python.
Perl is a family of high-level, general-purpose, interpreted, dynamic programming languages.
Python is a widely-used general-purpose high-level programming language. Python supports multiple programming paradigms, including object-oriented, imperative, functional and procedural paradigms. It features a dynamic type system, automatic memory management, a standard library, and strict use of whitespace.
The LAMP components are largely interchangeable and not limited to the original selection. LAMP is suitable for building dynamic web sites and web applications. The LAMP bundle can be combined with many other free and open-source software packages, such as netsniff-ng for security testing and hardening; Snort - intrusion detection (IDS) and intrusion prevention (IPS) system; RRDtool for diagrams; Nagios, Collectd or Cacti, for monitoring.
How does it work?
The Linux OS makes up the first layer. It sets the foundation for the stack model. All other layers run on top of this layer.
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.
The third layer is MySQL where databases live. It stores details that can be queried by scripting to construct a website. It usually sits on top of the Linux layer alongside Apache (the 2nd layer). In high-end configurations, MySQL can be off-loaded to a separate host server.
The next is PHP that sitting on top of all four-layer, and it's final layer. The scripting layer consists of PHP and/or other similar web programming languages. Websites and Web Applications run within this layer.
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.
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 all of these operations are enabled by the Linux OS running at the base of the stack. These four traditional layers of a LAMP stack consist of free and open-source products.
Advantages of the LAMP stack
Free and open source
You escape the costing for license fee while using LAMP. LAMP is cost-free, unlike WAMP wherein you have to pay a license fee to Microsoft.
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 customization 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.
LAMP has secure architecture and well-established encryption practices that have been proven in the enterprise.
LAMP can help you reduce development time. It's an open-source stack that has been available for more than a decade, and 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.
Apps or websites built with lamp technologies can shrink or grow with the demands being placed on it.
The code can work on a range of operating systems, together with Windows, Linux, Android, and iOS.
A large number of experienced and good-minded people in the community are ready to offer prompt support during the phase of development, deployment and so on.