Starting with PHP

Want to start using PHP? It’s a very flexible and useful language to learn for scripting on Web Pages. It’s also very easy to learn if you take the time.

First things first you need to ensure that your hosting has PHP capabilities. To check for this open Notepad and create a simple file called phpinfo.php. Insert the following:

<?php phpinfo(); ?>

Save this file and upload it to your server. Then visit http://www.domain.com/phpinfo.php. If a nice long list of confusing information about PHP is displayed, then it works! If it just displays the text as above then you may need to upgrade.

Alternatively, if you wish to test your PHP on your own computer you will need to install a web server and the PHP parser files onto your computer. You can either use a multi installer such as PHP Triad, which will install PHP, Apache Server and MySQL for you. Personally I prefer to install each individually, and I use Xitami Web Server with PHP. (You can also download MySQL from the MySQL Web Site.

Once these are installed and configured correctly (refer to the installation instructions), you should have a directory where all of your web pages should be stored to run on the local web server. Then, with all software running, you can go to http://localhost/phpinfo.php (save the file in your web page directory) to view the version of PHP running. You’re now ready to start making PHP pages!

Remember, all pages with PHP code in them must end with the extension “.php” to ensure that the server knows to run the page through the PHP parser first.

You may also like...

1 Response

  1. Sarah says:

    Here’s a good link for anyone needing a step by step on installing Apache, PHP and MySQL on their own PC – http://david-salisbury.co.uk/HOWTO-Windows-Apache-PHP-MySQL.txt