Getting started

The first thing to do is to open your text editor. You will use this to create the source code - the file that contains the commands you want.

Once you have done this, you need to type in some PHP commands. The first command you must type is to tell the computer that what follow are some PHP commands. Do this by typing:


on the first line in your text editor. Press return to go to the second line. Now enter:

echo "Hello World";

Note the ";" at the end of the line - this is important! You will get an error without it. The "echo" command tells PHP to write something to the screen. It uses any existing format, so isn't very sophisticated. You will see in the next article how to use HTML much more effectively to display stuff on the screen. Now hit return to go to third line in your editor. Enter:


This tells the computer that the PHP commands are finished. You should now have a full program that looks like this:

echo "Hello World";

Next, save your program. You need to give your program a name and add .php to the end of the filename. It is important that you have only .php at the end and not any .txt or .html or anything else. Your server will only recognise .php or similar as being a PHP program and it will not run any PHP commands without this. Note that each web server is configured to .php files as a particular version. Some may require a different extension to indicate a particular PHP version (like .php5).

Lastly, copy your program to the server using FTP or other software package. Your program is now ready to run. Run your program by starting your web browser and typing in the URL of your file. For example, if you called your program world.php then you type in as the URL. Your program will now run.

Now that you have run your first PHP program, you are ready to try something more useful

Next article: Showing Stuff on the screen


The first article tells you what you need to be able to run a PHP program.


The next screen gives you a tutorial on how to show stuff on the screen with PHP and HTML.
This tutorial tells you how to format text and how to get stuff to show on the screen.

External Links


  • Open your text editor
  • Enter your source code as shown right
  • Save your file as world.php or similar
  • FTP the file world.php to your server
  • Type the URL of your file into your browser