PHP 5.x with IIS 6.0

Due to a hardware fault on our old web server I had to move this homepage to a new machine.

Previously we were running on Debian Linux with the Apache web server. The server I had “spare” is a Windows 2003 Server machine. I installed the IIS 6.0 on it and configured the PHP extensions.

I had serious issues getting it up and running on the different web sites so I will show you with this manual how you can easily install PHP on IIS 6.0 and troubleshoot if you have any issues.

For those who are interested here is the System Info of our new web server.

http://www.tac-ireland.com/phpsysinfo/

Read more to continue…

1. Install PHP

1.1 Download and unzip the latest version of PHP (5.2.3 at the moment) to C:\<Directory>\PHP\

* Download the latest Windows Binaries of PHP from http://www.php.net/downloads.php and unzip it somewhere on your hard drive.
* Download the “PECL 5.2.3 Win32 binaries” zip file and extract the contents of that archive into C:\<Directory>\PHP\ext. It contains required extensions for mySQL or any other PHP addon. Move php5servlet.dll and php5activescript.dll from C:\<Directory>\PHP\ext into C:\<Directory>\PHP\.

1.2 Create php.ini
In your PHP directory, you’ll find a couple of php.ini-* files. For an easy initial setup rename the php.ini-recommended to php.ini.

2. Configure PHP mainly editing php.ini

2.1 Open the php.ini and uncomment cgi.force_redirect in php.ini and set equal to 0
*** This is a very important step, don’t neglect it. ***
http://me.go-unified.com/images/blogs/PHP%205.x%20with%20IIS%206.0/1.JPG

2.2 Install a browscap.ini file
For scripts like phpMyAdmin please download the php_browscap.ini from http://browsers.garykeith.com/downloads.asp to the extras directory under your PHP install directory (C:\<Directory>\PHP\extras\php_browscap.ini, for example), and change the browscap variable in php.ini to be the full path to the file (browscap=C:\<Directory>\PHP\extras\php_browscap.ini).

2.3 Create a session state directory and point the session.save_path php.ini variable to it. Create a session directory somewhere on the server or use the existing Windows one e.g. C:\Temp\. This directory will hold many small files with session variable information for PHP. Now change the value of the session.save_path variable in php.ini to be the full path to that directory (session.save_path=C:\Temp).

2.4 Setup the PHP extensions.
Now you have to enable some additional PHP extensions (For information on extensions, visit http://ca3.php.net/manual/en/install.windows.extensions.php)
The most important to start with is the extension=php_mysqli.dll simply remove the ; before it to enable the extension. This one is used for the mySQL database connection.

2.5 Create your PHP directory as variable PATH inside Windows
Make a rightclick onto My Computer – Press Properties – Select the Advanced tab – Click the Environmental Variables Button – Scroll down to PATH and double click same – Enter in there your PHP installation directory e.g. “C:\<Directory>\PHP\;” the final; is very important else none of your PATH info will work and your command prompt is useless 😉

http://me.go-unified.com/images/blogs/PHP%205.x%20with%20IIS%206.0/2.JPG
Reboot your PC to enable the made changes.

2.6 Add the IniFilePath into the Registry.
Click Start – Run – fill in regedt32 – and press OK
In the Registry Editor please go the HKLM and create under Software a new Key named “PHP” inside this key you create a new Strink named “IniFilePath” with your PHP installation path as value
http://me.go-unified.com/images/blogs/PHP%205.x%20with%20IIS%206.0/3.JPG

3. Configure IIS

Open the IIS mms. Click Start Administrative Tools – Internet Information Services (IIS) Manager

3.1 First you have to add the Web Service Extensions.
Press the + in front of your PC Name – select the “Web Service Extensions” – press “Add a new Web Service Extension” – Give the extension a nice name e.g. “ISAPI PHP Extension” – click Add and browse to your PHP installation directory ad select the php5isapi.dll – Check the “Set extension status to Allowed” checkbox and click “OK
http://me.go-unified.com/images/blogs/PHP%205.x%20with%20IIS%206.0/4.JPG

3.2 Add new extension (.php)
Now you have to tell the IIS what it should do when a .php file is requested.
Right-click on “Web Sites” in the left pane, then click “Properties” in the menu that pops up – Flip to the “Home Directory” tab – Click “Configuration” – Click “Add…” – Browse to the php5isapi.dll in the “Executable” textbox – Enter “.php” in the “Extension” textbox – Select radial button “Limit to“, enter “GET,POST,HEAD“- Click “OK” all the way out
This will apply to every website.

http://me.go-unified.com/images/blogs/PHP%205.x%20with%20IIS%206.0/5.JPG

3.3 Turn on scripting permissions for your websites
Right-click on “Web Sites“, goto Properties – Home Directory – Change the “Execute permissions” dropdown to “Scripts only“.

http://me.go-unified.com/images/blogs/PHP%205.x%20with%20IIS%206.0/6.JPG

3.4 Restart IIS
Right-click the local computer in the left pane of IIS Manager, click on All Tasks – Restart IIS… – Enjoy
4. Test your setup

4.1 Create a new file named test.php in one of the websites e.g. C:\Inetpub\wwwroot
As content simply type in the following:

<?php
phpinfo();
?>


Open the newly created file with the web browser and you will see the php info page that indicates a successfull installation!

59 comments to PHP 5.x with IIS 6.0

  • Your style is very unique compared to other people I have read stuff from.
    Thank you for posting when you have the opportunity, Guess
    I will just book mark this site.

  • Really when someone doesn’t be aware of after
    that its up to other people that they will help, so here it occurs.

  • naturally like your website but you need to check the spelling
    on several of your posts. Several of them are rife with spelling problems and I in finding it very bothersome to inform the reality however I’ll definitely
    come back again.

  • My relatives always say that I am killing my time here at web, but I know I am getting know-how all
    the time by reading such good articles.

  • This is really interesting, You’re an excessively professional blogger.
    I’ve joined your feed and stay up for searching
    for extra of your magnificent post. Also, I have shared your site in my social networks

  • I was wondering if you ever considered changing the layout
    of your blog? Its very well written; I love what youve got to say.

    But maybe you could a little more in the way of content so people could connect with it better.
    Youve got an awful lot of text for only having 1 or two images.
    Maybe you could space it out better?

  • Hi there! This is my first visit to your blog! We are a team of volunteers and starting a new initiative in a community
    in the same niche. Your blog provided us valuable information to work on. You have
    done a outstanding job!

  • In my case, I began mentally calculating the miles per gallon on the freeway against how much fuel I had left within the
    automotive.

  • What’s Taking place i’m new to this, I stumbled
    upon this I’ve discovered It absolutely useful and it
    has helped me out loads. I am hoping to give a contribution & assist
    other users like its aided me. Good job.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Bandwidth utilization bar