Monthly Archives: May 2015

Getting Started with PHP part 3

Now we’re ready to start putting some of this stuff to use!

OK now we have installed IIS (the server) and the PHP script engine to help IIS to run our PHP files. We need somewhere to put them. This is where IIS comes in. We need to create a virtual directory, if like me your inital thought was whats all that mean then? I’ll try and explain

Right well the easiest way to tell you about these is by example. Us Brits see virtual directories everytime we watch the BBC. They are always advertising their website e.g. or Now the bit on the end is the virtual directory, the /sport or /nature the is the domain name of the BBC. When we type in the browser will check with IIS and IIS will do 1 of 3 things:

redirect you to another URL (website)
redirect you to another directory somewhere on a network
redirect you to a directory on your local computer
So, what does this mean…?
It means that when you type in IIS looks at where that location points to (out of the above list) and takes the appropriate action, so if you have a directory or folder full of HTML files and you point IIS to look at that folder, when someone enters the name of your virtual directory IIS will go to that directory on your computer and pull out the file named either “index.htm” or “default.htm” or which ever file you specify.

So an example to make this a little clearer, you have a folder c:\yourvirtaldirectory and a virtual directory called /yourvirtualdirectory. in that local folder you have an index.htm page. When you type in http://localhost/yourvirtualdirectory (providing it has been set up correctly which we will do next), IIS should pull out your default document

e.g. http://yourcomputername/your-virtual-directoryname will point to c:\yourvirtualdirectory and vice versa.
This should become clearer once you’ve read getting started with PHP part 4.