The Apache Web Server

The LAMP platform includes the Apache web server. While it isn’t necessary to use Apache—PHP and MySQL can be used with other web servers—it’s our server of choice in this book. There are several reasons for this: it’s free in a monetary and open source sense, it’s the most popular server on the Web, it’s robust and scalable, it is the web server most commonly used with PHP, and it works on all popular platforms, including Linux, Windows, and Mac OS X. This section briefly explains web servers and Apache. We discussed how to configure Apache in Chapter 2.

Web servers are also known as HTTP servers. This describes their function: a web browser or other web client makes a request for a web resource to a web server using the HTTP protocol; the web server then serves this request and sends an HTTP response to the browser. There are essentially two classes of request that web servers can handle: first, requests for static resources, such as HTML, XML, or PDF documents, and, second, requests to run a script—often with parameters provided by the browser request—and return the output in a response. The latter class is central to web database applications.

Web browsers send textual requests to web servers. An HTTP request is a text description of a required resource. For example, the following is what the Lynx browser sends as a request for the resource http://www.invyhome.com/artist.php on the web server:

GET /artist.php HTTP/1.0 Host: www.invyhome.com Accept: text/html, ...

Get Learning MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.