The following is a guide to the LAMP stack, what it is, and why you need to know it. You will not be required to set-up a LAMP stack, but it is strongly recommended that you do. In either case, you will be required to at least know what it is. The following applies to Web Programming courses ITSE 1301, 1311, 2302, and INEW 2334.
This is not intended as a complete set of instructions and solutions. This is a guide and introduction to get you pointed in the right direction.
LAMP stands for Linux, Apache, MySQL, and PHP. Together, they provide a set of software for serving web applications via the HTTP protocol. Each component contributes essential capabilities to the stack:
Here is a great simple short video explaining LAMP. You should watch this first before reading further.
At a very high-level, the LAMP stack order of execution shows how the stack works. The process starts when the Apache web server receives requests for web pages from a user’s browser.
If the request is for a static asset like an image, an HTML file, or a client-side JavaScript file (a JS file is a static asset from the sever's perspective), Apache simply serves that asset back to the browser. This is known as a static Web page or static asset.
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 assembles assets and data to create the HTML that browsers require to display web pages. This is known as a dynamic Web page and can change with each run of the code depending on the functionality of the PHP code.
You can (and should) set up your own LAMP stack on your own development computer. If you set up your own LAMP stack you can develop all your code on your computer without using an external Web server. This saves a lot of time in development and allows you to use a great deal more developer tools because you have direct control of the environment. You can even set up virtual hosts so that you can host multiple Web site projects at once and switch between them seamlessly.
MAC Users: If you have a Mac then you already have a Unix-based computer. Linux is also Unix-based. So, if you have a Mac, you have the option of creating a MAMP environment directly on your computer instead of a LAMP environment in a VM. If you would like to do this, try this tutorial or search for how to set up a apache mysql php on Mac and good luck (I don't do Mac, so you're mostly on your own on this one, but I will try to answer simple questions if needed).
Windows Users: While not recommended, you can also set up a WAMP environment. This is LAMP, but the OS is Windows. This is not recommended simply because 90% of all professional web servers are Linux and unless you are going to work for Microsoft, you should learn Linux. With that said, WAMP does work. If you would like to do this, you can search for how to set up a apache mysql php on Windows and good luck (I don't do Windows, so you're mostly on your own on this one, but I will try to answer simple questions if needed).
The first thing you need is a Linux install. Linux, like any operating system, has to work alone. In other words, you cannot have Mac OS or Windows and have Linux running directly on the same hardware at the same time. You have several environmental options for getting Linux installed.
Linux is unlike Windows and Mac OS in almost every way. Windows and Mac OS are proprietary. There is only one most recent version of each. They are primarily designed as consumer products (especially Mac OS). They are constrained by the companies that own them.
In contrast, Linux is open source, free, and exists in dozens of different "flavors." Some companies have created proprietary versions but those aren't important for this discussion. You can reprogram, modify, and "hack" Linux all you like. Linux is not primarily designed as a consumer operating system (but that's changing slowly), it's a serious, industrial-strength server and developer operating system. Linux also forms the basis for countless other operating systems such as Android, Playstation, most IoT devices, embedded systems, etc. As such, you have a lot of choices. Here are the most popular to get started:
Once you've chosen your working environment and your Linux version, and you've installed Linux according to your version's instructions, you can install the AMP pieces. That discussion is too complex for this guide but there are many good online resources. The following are a couple for Ubuntu. If you want another install, just search for yours with the search terms "How to install LAMP on <insert your Linux version here>". Of course you will have to be good with the command prompt, so make sure you understand that first.