LAMP ServerLAMP Server

LAMP Server

Overview

The term LAMP  first referred to four key components that worked exceptionally well together for hosting powerful database driven websites (however since there are hundreds of alternative and supporting open source components that can become part of the server, the term LAMP is getting less precise). LAMP is an acronym for Linux, Apache, MySQL and PHP. Whether you create a shared account at an ISP, a virtual server at a cloud or dedicated provider, or a real metal and silicon server that you physically connect to the Internet, your site is running on the same LAMP software. The LAMP server you create is not somehow less than the other servers that are on the net, it is what they are using also.

Implementing a LAMP server to solve your business information management task requires that you think about computers in a fundamentally different way than you might be used to. Traditional software products (like your word processor or spreadsheet) run on your computer and save their data there. Computers used to run such programs are called "Workstations". By contrast, office accounting programs usually run on a network and multiple machines access one data-store on one machine. A LAMP server is analogous to this, it presents everything it has to you through your web browser.

To a professional and a beginner a LAMP server is a very different animal. If you download or buy a consumer distribution of Linux (like SUSE, Fedora, Ubuntu) you get a monster DVD full of every kind of productivity, entertainment, graphics, engineering and utility software you can imagine. Underneath all of this somewhere is LAMP, yes you can turn on and configure a LAMP server (using a myriad of dialog boxes), connect it to the net and it can host a website. But, nobody actually does this. Ubuntu (and the others), for example, have server versions, they can fit multiple times on a lowly CD. When you start it up what do you see after login? An empty black screen with a cursor flashing in the upper left waiting for you to type a command (you login to online servers using a program called SSH, and you see the same thing). People used to using Windows or the Macintosh wonder how can such a spartan user interface possibly be serious. But be patient, you will find this is the great strength of a true LAMP server. Commands can be documented, they are precise, a series of commands can be linked and submitted together. At the command line there is nothing between you and the server, you have a sense of control that cannot be matched on a system with a thousand dialog boxes that are always changing. Another surprising thing about a typical LAMP-server (for example one you might rent in the cloud or as a dedicated server) is that they do not actually have the AMP components installed (only the L, that is, the Linux is actually there). But, by typing one simple command you can install (or update) each component (assuming of course the server is connected to the net). Thus, to completely configure a server might involve typing only 20 commands. Some of these commands can be to install server maintenance and management software that present themselves as web applications that you access using your web browser (thus once the server is up and running you may only rarely use the command line).

LAMP Servers

To understand LAMP servers well you need to understand the server market they battle in. Two opposing camps dominate the delivery of internet content , note that the following explanation is vastly simplified and biased, I am obviously on the LAMP side of this battle:

* Historically Microsoft has overseen a lucrative empire that has grown into a staggeringly complex worldwide behemoth that makes users dependent and delivers endless moneymaking opportunities to an industry that has grown to help manage this complexity (and even add more layers of complexity). Universities train people in increasingly more specialized fields in the never ending pursuit of new ways to profit from this ever growing monster. New acronyms and proprietary jargon are constantly being developed to try to explain what is going on. Simple things developed outside their control are adopted and then made complex to make them inaccessible without a consultant. Any other software that does not fit into this picture is referred to as 'legacy'.

* The Open Source: This industry is built on the four main LAMP components described below (with more sub-components also). It is cooperatively managed by thousands of programmers (and millions of testers) around the world, many of whom do it as a labour of love. The basic components are available free and knowledgeable people can deploy a server quickly and at very low cost. Help of is easily available on countless forums on the Internet. In general, open source software (program code is openly available) has now become so good that for-profit companies find themselves competing with free products that are as good or better than theirs. Infact, thousands of new companies have sprung up to provide services to those adopting LAMP, making it easier, more scalable, cheaper, fault tolerant, etc. This has changed the landscape in the past few years. Cloud computinng is an example, now with an account at a cloud provider like Amazon, Rackspace you can create a virtual server and install Linux (with a choice of a dozen different distributions) in less than a minute. Your virtual server can be connected to a URL, backed up, templated to create others and removed quickly. And these virtual servers scale to meet traffic demands, have load balancing and integrate with specialized database servers. But to the programmer they look just like a traditional LAMP server. The quality of the tools in the open source LAMP movement has made this kind of integration possible.

* Everyone else: Many specialized solutions are sold but make up a minor share. The two 'camps' do not see eye-to-eye and criticize each other. Microsoft says the open source movement is not cohesive enough for the rigors of software development and they say that they make the cutting edge products because of their resources. They use their marketing muscle and connections to influence decision makers in big business to distrust Open Source. The Open Source movement criticizes Microsoft's abuses of power, their monopolistic approach, the expense, complexity, security, vulnerability, stability and quality of their software, etc. Both accuse the other side of intellectual piracy. Thus it is no surprise that the Microsoft camp has attracted businessmen and the Open Source movement attracts dreamers and idealistic people (but this is changing). Perhaps you know someone in the Microsoft camp who simply makes money in their little support niche, they are busy enjoying their new boats and cars, they do not see the open source train coming toward them. Also, many programmers who work in 'the Microsoft matrix' by day work in the open source movement at home at night! There was a struggle for open source to find a way to pay the bills, but this has changed, the products are so good that they can become the basis of an infinite number of support and integration business models. Larry Elison of Oracle (the world's largest database software developer) says it would be stupid to try to compete with a high quality free product, that is why his and others of the worlds largest software companies have been buying producers of LAMP products and effectively working them into their business plans.

LAMP Server Components

Getting your mind around the fundamental difference between workstation computing and client-server computing is the first step to harnessing the power of the web. The second step is deciding which client server technologies to use. The LAMP acronym is not generic, the last three components are brand name products considered the standard in each field (however more and more alternatives to each component are arriving all the time).

The L in LAMP is Linux. We can create a WAMP server using Windows instead. But almost no one does that because it is not as reliable and Windows just introduces a lot of extra headaches, expenses and security vulnerabilities. A LAMP web server does not need a graphical user interface because it does not need a video monitor. To a LAMP fan the GUI in Windows is needless overhead and extra things to go wrong. Thus, from a setup and administration point of view, Linux servers are almost always command line machines, they just give you a blinking cursor on the screen waiting for you to type a command. To install non-GUI Linux on a PC you simply insert the Linux CD, answer a few questions and it can install in minutes. Infact, since most Linux distributions have the LAMP tools built in the whole LAMP server can installed in a couple of minutes. Admittedly, most Linux distributions have the GUI tools built in also. However don't use one of these. I can tell you which ones to use.

The A in LAMP is for Apache (the actual web server software). It runs all the time on the web or network connected Linux computer waiting for requests for the delivery of web pages. These requests come in as a stream of text in a language (or protocol) known as HTTP. Browsers know how to talk HTTP. As already noted, Apache is the only server needed on 'dumb' web sites that simply serve up static pages on request. For example, if you type the URL of a web site into the address field of your browser (usually Internet Explorer or Netscape) and click Go it formulates an HTTP page request to the server at that site. That server then simply sends the page, that is, the file on the server computer having the name specified. Your browser, a program that only knows about user interfaces, receives it and displays it according to any HTML embedded within the page.

In a LAMP system much more than this happens. LAMP based web sites or applications appear to be thousands of pages but these pages are actually assembled at the moment of request from just a few templates. When you click the "Find" button on Ebay, for example, the web server execute program code that does the lookup by calling the SQL server and assembles a page showing the items it found. Likewise, when one of these links is clicked the web server executes program code to lookup the details of the item. In a LAMP system the SQL database product employed is MySQL and the program code woven into the pages is written in a language named PHP (more information below).

The SQL server, like Apache, runs all the time waiting for database requests. However unlike Apache, SQL only accepts SQL requests from programs written in a language like PHP. When a web page contains a PHP program the PHP interpreter is launched on the server and it interprets the PHP instructions on the page and carries them out. It is thus the PHP program code that interacts with MySQL and Apache.

Another important thing to grasp about client server technology is the stateless nature of servers like Apache and MySQL. After they honor a request they completely forget everything about the client. Without the burden of having to remember anything they can obviously run a lot faster and not have to bother with complex housekeeping. However you might wonder how a web application can present an interface that is always what you want without remembering anything between one request and another. Everything that needs to be known or remembered must be on the page or maintained in variables embedded within forms on the page or in a session file. In this way the client remembers everything and 'refreshes the memory of the server' at the beginning of a request.

Keeping this in mind will help you understand the differences and similarities in the way you enter and save information in a client server system compared to a dedicated program like Microsoft Excel. Consider opening a large worksheet file, perhaps a compilation of your expenses and revenue for a year. Once the sheet is opened Excel presents a very elaborate representation of the information and provides many tools to change, report and study the data. When you are finished you must be keenly aware of saving the worksheet or hours of work could be lost. Also, likely 99% of the time that worksheet file sits on the computer without being used because Excel is not even running.

Consider the difference in the way a client-server system works. First of all, it is running all the time that the server is on. Second, sessions on the client are less interactive and you edit much smaller pieces of information at a time. Third, to the user there is no sense of the way in which the data is being stored or where it is stored. Fourth, LAMP implementations are a combination of two servers, a client, a language (and a bunch of programs written in that language) and a network. At first it might seem that this method has vastly greater program resources and therefore would run slower, have greater complexity and suffer greater chance of failure. However this is not the case. Each component is highly specialized to its function and one company takes responsibility for it. Each component is highly tuned and therefore very fast. In addition, the total size of the SQL server, Apache and the browser can easily be smaller than the spreadsheet program. Finally, program code runs on the server so money invested in a fast server benefits all clients that use it, as long as the client computer is capable of running the browser that is all that is needed.

The growth of the internet is an example of the power of client server computing. Sites like ebay and amazon demonstrate the staggering power of web servers. They can hold vast amounts of information and serve clients from the entire world, treating each as an individual. The idea of storing your data on a web server may have seemed foreign until now, but sites like these are excellent examples of how just such an approach is now becoming available to everyone.
Apache Web Server

Apache is the name of the most common web server used on the internet. It is the creation of the Apache Software Foundation, a worldwide group of programmers. Few people are aware of how much we owe to this dedicated and generous group of people. Apache is free to anyone that wants to download and install it and it works on an amazing array of different operating systems. Simply visit www.apache.org and download the appropriate version. The windows installer is very easy to use. The product is mature and changes take place slowly and are a product of a lot of worldwide discussion.

Apache is pre installed on almost all versions of Linux and on Macintosh OSX computers.

The major commercial competitor to Apache is Microsoft Internet Information Server (IIS). The latter has a method of embedding programs within the HTML of web pages akin to what Apache does with PHP (they call it Active Server Pages but it is pat of a vastly more complex and troublesome universe that an empire of service companies to exploit).
SQL Database Server

SQL (Structured Query Language) database servers are the real magic behind sites like google and ebay.com. For the latter, tens of millions of items are on sale with as many registered users and the SQL server can respond to any question about the data in milliseconds! SQL is actually a language with a well defined syntax whose purpose is to provide a way for clients to ask servers for data. The beauty of SQL servers is that they take care of things like indexes, filters, orders, relations so that programs do not need to worry about them.

MySQL is an amazing product from a generous company in Germany that wants to make a world class database that everyone can afford. MySQL AB employs a hundred or more programmers and works with thousands of testers and advisors around the world. The major commercial competitors are Oracle and Microsoft SQL server (they can cost tens of thousands of dollars!). MySQL is pre installed on Linux and OSX and Windows users can download a free easy-to-use installer from www.mysql.org. It works best on Windows 2000-Vista and when installed a small icon on the task bar gives you access to a control panel for the server.
PHP Programming Language

PHP is a computer language, sometimes called a scripting language. It has taken the web development world by storm in the past few years and is now the most popular one used. The language is actually just a single remarkably small program file that is called by the server operating system to interpret PHP code woven into HTML pages. It can be used directly as well, you just make a script using a text editor, name it with a PHP extension and drop it on the Zend engine file to execute it. PHPs success compared to commercial alternatives lies in its speed of execution, small size and overhead, cross platform support, clean and flexible syntax, effortless interface with web servers and relentless development by Zend.

PHP is pre installed on most Linux systems and on OSX. It is available for Windows also and anyone can download it for free at www.zend.com. This company, like MySQL, has an open and progressive philosophy and markets many enhanced forms of the product to generate revenue.
Using PHPMyAdmin

phpMyAdmin is a set of PHP scripts that forms a web site dedicated to the task of administering a MySQL server. You install it on a web server by simply copying the files into a folder and then editing a configuration file to set the password and user name for the server, the URL of the home page and the file path to the folder. To begin you simply go to the home page of phpMyAdmin using your browser.

phpMyAdmin gives you a user interface to create and remove databases and tables; add, edit and remove fields in tables and to insert, delete and edit data. It compiles SQL syntax commands to submit to MySQL and displays the SQL so you can see it. It also provides a text box where you can paste in an SQL command and directly execute it. This is a very powerful tool, you could make changes to thousands of records with a single statement. Check www.phpmyadmin.net for more information.
vTiger, A Good Example

If you would like to see a WAMP system in action, try downloading and installing vTiger CRM (vtiger.com). The 25mb installer will put Apache, PHP, MySQL and vTiger on your workstation and give you an item in the start button to lauch everything. It is amazing to see it in action, a mini-internet within one computer.
Getting Started, Learning

Linux LAMP servers are obviously the best but interestingly the best route I have found to get started with one is through Windows. Here are the steps:

* Download XAMPP and install it on your Windows computer (XAMPP is a Windows install of the popular Linux Apache webserver, MySQL database server, FileZilla PHP and PHP programming language, and other things). The default home page will be available at http://localhost/xampp, it is coming from your own machine, not the Internet.

* Compose your website in the htdocs folder in the XAMPP folder and experiment for a few months.

Forget about connecting that XAMPP site live to the Internet, it will be hacked in no time. You need to move your site to a LAMP server.

* Install LAMP on your own server or at a cloud or dedicated service provider (shared hosted providers are slow and much less secure).
* Buy a URL and get your provider to help you to map it to your server.
* Use google to learn how to connect to your server via SFTP using Fillezilla (to be able to copy files to the site).
* Copy the files from XAMPP to your LAMP server.

Source: http://digitalfire.com/dreamsite/LAMP.html

0 comments:

Posting Komentar