Web Server Basics


Part I: MySQL tutorial
Part II: PHP tutorial

Start:



Links:
MySQL Manual
PHP Manual
Student Server Home

Web servers work on a client-server model.

This means that the client, usually a desktop computer, sends a request to the server, usually some heavy iron in a well-guarded backroom somewhere. The server interprets this request and gives an answer.

The simplest request is a static web page; a client might ask something like: "http://www.nebrwesleyan.edu/index.html" This means: using a certain protocol (HyperText Transfer Protocol, in this case), give me a file called "index.html" on the computer called "www" at the domain "nebrwesleyan.edu". So the web server fetches that file and sends it over. Easy enough.

But you aren't here to learn about web servers. You're here to learn about PHP, which throws a curveball into this. PHP files, unlike HTML files, contain their own instructions that the server follows. So in the similar request "http://www.nebrwesleyan.edu/index.php", the well-configured web server knows that it first has to interpret the commands contained in the PHP file.

This is because a PHP file doesn't look like an HTML file, and a web browser wouldn't know what to do with it. We say that PHP is a server-side scripting language, because the server does all of the work. (By contrast, JavaScript is a client-side scripting language, because the client -- the web browser -- is smart enough to understand it.)

Consequently, the picture of a server running PHP will look more like this:

The client sends a request to the web server, which then passes that request on to a PHP interpreter that can understand all of the magic in the .php file.

The most common application of PHP, and the one we'll be covering in this tutorial, is to interface with a database system, in our case MySQL.

Why PHP and MySQL, though? Why a web server called, of all things, "apache"? After all, Microsoft makes a web server, called IIS, a similar scripting language called ASP, and their own database solution, called SQL (pronounced "sequel").

The tantalizing answer, next!