Programming & Scripting Tutorials

PHP: Introduction and Setup

So what on earth is PHP?

PHP (PHP Hypertext Preprocessor (yes – it’s one of those inception, recursive acronym things)) is a widely-used, server-sided scripting language for the web.
This means that we can essentially change what the server does so it can generate dynamic web pages and serve them to the user.
You’ve probably already heard of PHP since *give some impressive statistic about how much PHP is used around the web here*, but you may not be aware of how powerful it is. It’s open source and can be (and currently is being) used for things from the most simple “Hello World” application to the most demanding applications on the web.
It’s powerful, it’s easy to use, and it’s free!

So what can PHP do?

As the PHP documentation brags: “Anything”! It can do typical server-side things such as collecting and dealing with form data, sending and receiving cookies etc, but is actually so powerful that it can even do command line scripting and can even be used to create desktop applications (although it’s certainly not the best for it)!

So let’s get started.

Installing and setting up PHP

Before we get started having some fun with PHP, we need to get a programming environment setup. You can either setup PHP (and you might also want MySQL for database stuff although we won’t be using it immediately) on a remote VPS or server of some kind (such as a Linode), or on your local machine.

It doesn’t really matter either way – but it is generally a lot easier and more flexible if you set everything up on a UNIX based machine (Linux or Mac preferably) although it is of course possible (and still relatively easy) on Windows.

Instead of my tediously following you through the process (which not only would be boring for both of us – but the instructions would probably be outdated as obviously PHP gets updated and changed over time) – I’m just going to link you to the documentation in which there are clear instructions for install on a variety of platforms. Follow the instructions for PHP 5.2 or later (or at least that’s what the page says at the time of writing this tutorial). The links are as follows:

Windows PHP Install - http://www.php.net/manual/en/install.windows.php
Mac PHP Install - http://www.php.net/manual/en/install.macosx.php
Linux (UNIX) PHP Install - http://www.php.net/manual/en/install.unix.php

After you’ve installed a version of PHP that’s good for you (I’m personally using 5.3) then you should be good to go!
If your having trouble with this official documentation, there are a tonne of instructions which are available via a quick Google which might help you out (or if your STILL having trouble - try posting your problem on the Dev-HQ forums: http://forum.dev-hq.net/).

With PHP installed properly – you are ready to continue to the next tutorial!



This tutorial was written by


Back to PHP

Advertisement: