JonMcCain.Net
[top]

What is the LAMP model and why is it so popular?

LAMP stands for Linux Apache MySQL and Php (sometimes Perl). This combination of software applications allows web pages to be able access a database. This set of tools is becoming so widely used that Microsoft feels threatened by it. The fact that they are even aware of it means that it is pretty important. They even have an article on how to convert from it to a Windows based model. I like to call this the WIMP model (Windows IIS MySQL Php). One of LAMP's big advantages is that is free.

This article won't describe the technical details of installing and configuring these applications.  It will just the describe the LAMP model in general and point out what makes it so good.

L is for Linux

Let's start with Linux.  Linux is the operating system.  It is based on unix and is very,very stable.  Did I mention that it is free? The OS itself is free along with it's thousands of applications.  Plus there is is no per user license fee.  As many users as your server can handle will be able to access it.  Linux performs very well as a server.  Over 70% of the internet runs on unix based systems. Linux can also be made very secure.  It is generally very easy to update applications when security bugs are found.  And this doe not require changing the whole operating system, just the application. Once a linux system is configured it can be left alone.  Many systems go months not days without having to be rebooted.  In many cases the only time you will have to reboot is when the kernel itself is modified. Linux is very efficient. It does not require a very powerful cpu or huge amounts of memory to work.

A=Apache

In order to host a web site you need a web server.  Apache is a free web server that is very powerful.  Apache has been shown to be substantially faster, more stable, and more feature-full than many other web servers.  It is an HTTP/1.1 compliant web server that is highly configurable.  It can be customized by writing modules using the Apache API.

Apache has been tested thoroughly by both developers and users. The Apache Group maintains rigorous standards before releasing new versions of their server.  This is what helps make it so stable and secure.  One of Apache's strong points is that it an open source project.  Most of the developers are users.  Therefore they have an interest in putting in new features that are truly useful and keeping things bug free.

MySQL,Yoursql,Everyonessql

Next we need a database to store some information.  MySQL is a free database that is very fast.  It is extremely popular and therefore there is a lot of support help. Extensive reuse of code within the software and a minimalistic approach to producing functionally-rich features has resulted in a database management system unmatched in speed, compactness, stability and ease of deployment. The unique separation of the core server from the storage engine makes it possible to run with strict transaction control or with ultra-fast transactionless disk access, whichever is most appropriate for the situation.

The MySQL database server supports a broad subset of the ANSI SQL 99 syntax, along with extra extensions. Alternative syntaxes from other database systems are also supported, to make porting applications easier.  It also supports technology such as views and stored procedures.

You can connect to a MySQL database server from all of the major platforms, using nearly any programming language, with  a standard threadsafe client library.  Many languages such as PHP contain built in commands that make it easy access data.  There are also ODBC drivers available.

Give me a P, Give me an H,Give me a P

PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a scripting language, with a particular affinity for and emphasis on enhancing Web pages. It was designed to be used for web pages from the very beginning.  It has a syntax very similar to C (with a smattering of Perl and shell), and includes lots and lots of functions for things like database access, dealing with CGI requests, and image creation and manipulation.

When PHP is used as an Apache module, the language elements are embedded in the document pages themselves.  The code is executed on the server inside Apache. A file might look something like the following:

     <body bgcolor="#ffffff">
     <h1 align="center">Acme Products</h1>
     <h2 align="center">Welcome back. Today is
      <? php
            $date = get_the_date();
             echo $date . "! ";
       ?>
      </h2>

When a Web client requests a PHP-enabled page, the mod_php module gets to interpret the document and make changes to it before the Web server itself sends the results back. The results of the above PHP fragments might cause the following to be what the Web client actually receives:

    <body bgcolor="#ffffff">
     <h1 align="center">Acme Products</h1>
     <h2 align="center">Welcome back. Today is Friday April 1,2000!</h2>

Notice how all the stuff between "<?" and "?>" was replaced—interpreted by mod_php—before it reached the browser? That's part of the power of PHP. What distinguishes PHP from something like client-side JavaScript is that the code is executed on the server.  The user can not see your code, only its output.

With PHP you are not limited to output HTML. PHP's abilities includes outputting images or PDF files on the fly. You can also output easily any text, such as json.

One of it's best features is that  PHP can access a wide range of databases with ease.  One of them is MySQL.  Thus you can have web applications that access data from a relational database.  PHP even supports ODBC so you can connect to any database that has an odbc driver.

PHP also has support for talking to other services using protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (on Windows) and countless others. You can also open raw network sockets and interact using any other protocol.

PHP has extremely useful text processing features, from the POSIX Extended or Perl regular expressions to parsing XML documents. For parsing and accessing XML documents, it supports the SAX and DOM standards.

PHP is extremely simple for a newcomer, but offers many advanced features for a professional programmer.  You can be writing useful PHP scripts within a few hours.

Conclusion

Now do you see how it all ties together?  Linux provides the stable environment.  PHP can access the MySQL database while running inside the Apache web server.  Everything compliments each other.  They are very fast when they all work together.

But that's not all. You can have an Apache, MySql and Php environment in Windows! XAMPP is set of tools that pulls together the windows versions of these applications. I'm actually using it right to develop this web site. Sometimes it's easier to work on your local pc instead of a hosted website. You get everything working and then upload everything at once.

Date: 8/1/2018