PHP - Chapter 1 - Your First Script


Your first script is very basic and can be used to test your server's implementation of PHP. Type (or paste) the following code into a text editor and save the file as "script01.php" (without quotes).

Definitions (in layman's terms)

First let's cover a few definitions you will need to know in order to advance your knowledge of programming.

Server: This is the computer that holds/processes the information that is requested by a client.

Client This is the computer that requests information from a server.

Script: A set of instructions that is executed by a computer.

    <title>My First PHP Script</title>

Upload the file "script01.php" to your server and navigate to the page using your webbrowser. You should see a large listing of information about the PHP implementation on your server.

If your script doesn't work, a blank page may be displayed, your page source may be displayed, or you may be asked to download the file. Check for typographical errors first. If you are confident you have typed the code correctly, your server may not have PHP installed or it may be incorrectly installed.


phpInfo() is a standard PHP function that prints out information of the server and the server's implementation of PHP.

Notice the line ends with a semicolon. As with many other scripting and programming languages, PHP requires statements to be terminated with a semicolon. This is important and one of the hardest errors to find in more complicated examples.

PHP Index Next - Working With Text >