PHP 5

PHP is an extremely popular, Open Source scripting language, most commonly used on web servers to produce dynamic pages. The name "PHP" is a recursive acronym for "PHP: Hypertext Preprocessor" and was initially created by Rasmus Lerdorf in 1994. As of today, the current version of PHP is version 5, with version 6 in the making.

As mentioned,PHP is mostly used on websites, which is what this tutorial will focus on. You may wish to set up your own test server, which is very easy to do, using the next couple of chapters to help you out. If you already have a server up and running or at least access to a server running PHP 5, you can jump to one of the next sections, where we will start writing some PHP. You may go through all the chapters of this tutorial step by step, or you may jump between chapters to learn specific things - it is really up to you.

How to start PHP?

To start working with PHP, and later on MySQL, you may install it on your own computer, for easier testing. Another way of doing it is paying for a web hotel with PHP and MySQL access, but testing on your own machine is much easier to work with, especially while learning. Installing it has become much simpler than "back in the old days", and with the following chapters, you should have all of it installed and ready to go within 10-20 minutes.

Webserver
Apache is the web server, which makes sure that your machine becomes capable of serving webpages. You may not want to run a public web server on your machine, but Apache is good for testing purposes as well, it is very easy to setup, and it works great with PHP. Apache is free software, which, very simply put, means that the source code is available and you do not have to pay for it.

Installing PHP
After installing the web server, we need to install PHP it self. It will work together with the Apache web server we just installed, to allow the web server to process PHP documents and return the content to the client. To read more about how this works, have a look at the introduction chapters of this tutorial. In case you started Apache before, close it down now - otherwise, the PHP installer might not be able to modify the required files!

PHP should always be downloaded from php.net . This blog is based on PHP 5, so you should get the latest stable version of PHP 5 for Windows. Select the installer under "Windows binaries". You will get a list of mirrors which should be close to you. Pick one and download the file.

Get Start
Once we have installed Apache and PHP, we can start executing PHP code on our own computer. But how does it work? It is actually quite simple. Once we installed PHP, it hooked into Apache, and made the necessary changes to the configuration files to allow Apache to communicate with PHP and get the PHP code interpreted and returned to the client. A file within a set of subfolders can be reached like this:http://localhost/folder1/folder2/filename.php.

Leave a comment