Getting started with PHP

PHP (Hypertext Preprocessor) is a popular web programming language used to create dynamic web pages to fully functional web application. Popular web application that uses PHP includes PHPBB, WordPress & Facebook.

PHP file

  • PHP files extension can be *.php or *phtml. Most commonly used is *.php.
  • PHP files can of course contain PHP code but it can also contain any code/script that can be place in a HTML file (i.e. HTML, CSS and Javascript).
  • PHP files are returned to the browser as plain HTML.

Editing PHP files
You can use any text editor to create and edit PHP files, these includes Notepad & Notepad++. There are other applications written especially for PHP but they are generally for more experience & advance programmers. Some good applications includes Netbeans & Eclipse with PHP plugin.

A more technical term for these code editing applications is IDE (Integrated Development Environment).

Where to begin

First you need to check that the server you are going to host your PHP files supports PHP. Most servers do, but you want to make sure first.

If you have any applications that uses PHP already installed and working on the server then you don’t need to check.

Simple way to verify that the server supports PHP

  1. Create a file called “test.php”.
  2. Place the below code into the file:
    [php]
    <?php
    echo "Hello World";
    ?>
    [/php]
  3. Upload this file to your server (inside public_html folder).
  4. Then open the “test.php” file in the browser.
  5. If you see the words “Hello World” on your screen then your server supports PHP. If you don’t see anything, then make sure you have copy & pasted the above code exactly or contact your hosting provider to query them about PHP support.