Home > Software > Installing PHP 5 for IIS 6

Installing PHP 5 for IIS 6

This is how I installed, tested and currently use PHP 5.2.3 with IIS 6. At the time of writing PHP version 5.2.3 is the current release, but I expect this to work with future releases to. This article assumes you already have IIS installed.

I would like to say that I would have preferred to have installed apache on my server. I opted for IIS simply because I use OWA. Whilst both web servers have their pros and cons, I would have preferred apache for its mod_rewrite module. I know there are commercial ISAPI modules available (and a couple of freebies with limitations) but when weighing up the cost of losing webmail IIS was the route I decided upon.

Download the PHP installer from HERE

Now run the installer and install to the recommended directory of C:\Program Files\PHP\

When prompted for the type of Web Server you wish to setup select IIS ISAPI module

php1.PNG

On the next screen, from the list of extensions available, select the following to be installed on the local hard drive: GD2, MCrypt, Multi-Byte String, MySQL, and MySQLi. I chose these extensions because I use a MySQL database and phpMyAdmin to manage the database.

N.B. If you find you need additional extensions later on, you can run the installer again and select the extensions to be installed from the list available.

php2.PNG

After the setup has finished restart IIS by opening the IIS snap-in, selecting the computer icon (with the name of the computer you have IIS installed on), right clicking, selecting all tasks and choosing restart IIS

php3.PNG

When prompted with 'What do you want IIS to do?' select the option to 'Restart Internet Services on computername' and click ok

php4.PNG

Now, still within the IIS snap-in, browse the 'Web Sites' folder and right click the 'Default Web Site' to select properties. Select the tab named 'Documents' and add index.php to the list of default content pages. You may want to change the order in which IIS displays index pages, I moved index.php to the top of the list.

php5.PNG

Now select the tab named 'Home Directory' and click on the 'configuration' button. Scroll down to .php in the Application Extensions window, click it to select the .php extension and click the 'edit' button. Now change the Executable path from "C:\PROGRA~1\PHP\PHP5IS~1.DLL" to "C:\Program Files\PHP\php5isapi.dll" (with quotes).

php6.PNG

N.B. If you create any virtual websites (other than using 'Default Web Site') you will have to perform this step on them as well.

Now I made a couple of changes to the 'php.ini' file. Edit C:\Program Files\PHP\php.ini and change display_errors = Off and log_errors = On to display_errors = On and log_errors = Off. Also change both upload_tmp_dir and session.save_path paths to "C:\WINDOWS\Temp". The default paths for both of these settings is a directory that doesn't exist, hence the need to change it.

Now restart IIS again like you did earlier.

Now in the document root folder for IIS, (for me this was 'C:\Inetpub\wwwroot') create a new file called index.php using notepad or your favourite text editor. In it save the following text:

php7.PNG

Now open your browser and browse the local computer by typing http://localhost or http://127.0.0.1 into the web address bar of your browser. you should be presented with a screen similar to the following, displaying the configuration of your PHP setup.

php8.PNG
(click to enlarge)

If you see that page then your PHP installation for IIS has been a success!

Categories: Software Tags: ,
  1. No comments yet.

*

code