As stated in part I web sites can be broken down into halves, the front end or browser side and the back end or server side. In this article we’ll be discussing the server side and in particular that set of tools collectively know as LAMP.

Server Side with LAMP

LAMP stands for Linux, Apache, My Sql, Php and is currently the most frequently used mix of technology on the server side – commonly referred to as a “web stack” or more specifically a “LAMP stack”. Linux is the operating system that hosts the entire system and both an Apache Web Server and a My Sql database run within that operating system. Php is a programming language that can be run within an Apache web server and has excellent support for interacting with databases such as My Sql. With Php we can serve back dynamically changing content when we receive a request for a given web page or other types of content. As a brief aside, in lieu of Php some development shops opt for Python or Perl, Php however is the most prevalent. All of the components in a LAMP stack are open source and free – a primary reason for it’s popularity.

In part one we compared a website to a constructing a physical building. Continuing with that analogy we might look upon a LAMP stack as a power plant. It’s not pretty in and of itself but without a web stack on the back end none of the cool stuff we see on the front end would be possible. Just like how a power plant pushes out raw power to factories and homes our LAMP stack pushes out our raw content – images, html files, style sheets (css), and javascript files. It does not render this content, that’s what the browser does. Our LAMP stack responds to requests for content from the browser and delivers it back to it in an efficient manor. Closely related and sitting on top of our LAMP stack we might have a content framework such as WordPress. These are systems that leverage our LAMP stack in order to allow us to manage our content with a more user friendly interface. Collectively such systems are referred as Content Management Systems or CMS. WordPress for example is written in Php and makes use of a MySQL database to store posts and other data. It is expected that the entire system is run from a web server that is running on a Linux system. Other types of wordpress configurations run on Mac and Windows, run with other web servers, and use different types of database products but the LAMP stack is by far the most popular.

To give just a little more color to LAMP we’re going to walk through a very simple request from a browser and how that might be handled on the server. In our example we type in the url https://phoenixroberts.com/lamp.php?id=891. The browser requests the file lamp.php from the site www.phoenixroberts.com. When our Apache web server receives the request it recognizes it as Php and knows that it needs to run the program contained within the file lamp.php – instead of simply returning the contents of the file as it might do for an image or html file. As for the program contained in lamp.php – for this example it’s comprised of instructions to select all the dates of the various versions of this article and return it back to the browser in a formatted fashion. If we supplied a different id, say 211 – the id of part I of this series – then we’d get all the revision dates of that article. This is an example of dynamic content as performed by the back end. Different parameters passed into a request return different database records, files, or images. On the front end dynamic content is more or less a function of formatting what has been sent down from the server – the content however is always limited to whatever has been received from the server. For example, a front end focused solution would be to retrieve all the data from the server at once but only show a portion of it using javascript. The query might take longer but once the browser has the data it’s very quick. Like most solutions the right answer depends on the circumstance – e.g. how much data is being pulled down?

A word about hosting

Although LAMP may be free the hardware that it runs on is not. In order to run a CMS such as wordpress for example that runs on top of a LAMP stack you will need to purchase hosting plan. Plans run anywhere from less than $5 a month to hundreds of dollars. The difference in price depends on things like disk space, bandwidth, server memory, processing power, support, and the type of access to the system you desire. If you’re reading this article with an eye towards developing and supporting your own site you are definitely under $50 a month for a plan. On the higher end you will encounter things like “dedicated servers” where you have an entire machine somewhere that is dedicated to only running your site. On the lower end you have “shared hosting” sometimes called “virtual hosting” where you’re site is on a machine with many other sites and a single web server serves content for all the sites. The middle ground is what is called “Virtual Private Servers” or VPS as well as their counterparts Managed VPS. Below I enumerate the most common options with brief descriptions as well as some pros and cons.

  • Shared Hosting – Inexpensive and low end hosting solutions. All sites on a shared host exist on a single web server with no dedicated resources.

    • Pro: Really cheap – sites can be had for $5 or less.
    • Con: Resources are limited and shared. If another site on the system should bog down the server your sites performance will be directly effected.
  • Virtual Private Server – A moderately priced solution where although a physical machine is still shared between multiple sites you have a dedicated portion of that machine.

    • Pro: More power, more configuration options, your site will not be impacted by other sites usage of resources.
    • Con: More work to run than a shared hosting option. With more flexibility usually comes more complexity.
  • Managed VPS – The benefits of a Virtual Private Server but without the extra work required to configure. Typically managed VPS sites are pre-configured for given use (e.g. WordPress)

    • Pro: If you can find a Managed VP solution that fits your needs setup and maintenance is no more complicated than a shared solution, possibly less.
    • Con: A little more expensive than VPS and you must fit a particular use case to take advantage of this option.
  • Dedicated Server

    • Pro: The sky is the limit regarding configuration options (or perhaps more accurately, your wallet is the limit)
    • Con: Expensive and complex. Dedicated can go for several hundred and as stated previously with more flexibility comes more complexity.

Summary

So now we’ve gained an understanding of what is meant by “front end” vs “back end” – essentially what takes place within the browser (rendering and display) vs what takes place on the server; location and transmission of content from files, database, and executed programs (e.g. Php) to the browser. We’ve also acquired some information on common options for hosting our server – pros and cons. This has been a high level discussion and limited to the most prevalent configuration on the web. A basic server side configuration will consist of these four primary options:

  • “L” – An Operating system (Linux)
  • “A” – Web Server (Apache)
  • “M” – A Database (My Sql)
  • “P” – A Programming Language (Php)

Know these four and you should be able to get an understanding of the additional options available by placing them in terms of these and the purposes they serve.