This article is the third in a series on web development for the non-programmer. For the first, go here.
To a visitor, a web page is simply an HTML file (with its associated images and other resources). It doesn't matter where it comes from or how it's made. A web server could act much like a hard drive, simply storing and retrieving HTML files. However, such a server would be static: the pages would always be exactly the same for every visitor. While this is fine for some sites, many sites need features that aren't possible with static pages: features like visitor accounts, changing statuses and online purchasing. To do this, web servers need to create and serve HTML pages dynamically.
In order to dynamically serve web pages, web developers use a suite of server-side applications and tools. At the heart of these is the server itself. This is the application that receives incoming connections, retrieves the web page (either from a file or by calling a program that generates it) and sends it to the client. The server also responds to requests for images and other resources, usually by simply retrieving the file requested. Note: confusingly, the term "server" is applied at several different levels, with context determining whether it references the machine ("The server is down"), the operating system ("Windows Server 2008"), or the actual program. There are currently two popular server applications: Apache, a free, open-source, cross-platform server for general use, and IIS ("Internet Information Services"), Microsoft's server software targeted mainly toward businesses. Both have many features beyond simply passing HTML files, including standard plugin systems that allow them to handle virtually any input or output. Each is able to handle multiple simultaneous requests, running the necessary plugins separately for each request.
Generally web pages are created using a programming language that is specifically adapted to the task. Common languages include PHP (with Apache) and ASP.Net (with IIS), but practically any language for which the server has a plugin can be used. Since HTML files are basically text files, they can be created using any process that generates text. However, most languages use a template-based approach, where the body of the web page is stored as a template, with fields or areas that can be filled in dynamically using code that the web developer writes. This could be something as simple as filling in the visitor's name or as complex as generating a list of products for sale with pictures and "buy" buttons. Large, complex websites have millions of lines of code, all centered around generating the text in the HTML files they serve.
It is possible for a web site to handle all the data involved with creating and serving web pages on its own, either stored in temporary memory or in files on the hard disk. However, most larger web sites use a database for that purpose. A database is a program or system used to quickly and easily store and retrieve large amounts of data. They keep the data safe and secure, and help prevent issues such as two users trying to change the same data at the same time. They aren't limited to web applications, but they are ideally suited for them. There are quite a few different database systems, each targeted at a different usage sector. Microsoft's SQL Server, for example, is aimed at large business applications, while MySQL is generally used for smaller sites and programs, and SQLite is an extremely lightweight database for applications that need only basic functionality. The vast majority of databases use a language called SQL ("Structured Query Language") to store and retrieve data.
To sum up the server-side process, then: When a visitor sends a request to a web server, the server application receives that request. It determines how that request is to be processed and passes it to the appropriate plugin or program. If the web page is to be dynamically generated, the code that the web developer wrote is run, often using templates to create the structure of the page and retrieving page data from a database. The completed page is passed back to the server application, which sends it to the visitor's computer.
The server-side process is the heart of web development, and to attempt a short list of related topics and current events would be foolish. The field changes continually as new program versions are released and new techniques are developed. One of the long-standing debates is between using the open-source Apache server and related technologies versus the closed IIS/ASP.Net system. An open-source .Net platform, Mono, was recently released that promises to mix things up a bit by allowing ASP.Net pages to be run on Apache (and other) servers. Cloud hosting is also gaining ground as a viable option, with pages being created and served from any one of a number of shared servers across the internet.
Stay tuned for next month when we go more in depth on other aspects of web development.
For the best prices, on the largest selection of faucets, from your favorite brands like Kohler, Danze, and American Standard shop PlumberSurplus.com 24 hours a day, 7 days a week.