Main menu

SmartFeed by FeedBurner Subscribe to the site feed.


If you find the information here useful, then please consider a small donation, or linking to this site.

Recent Comments

Recent Tweets

  • @CIOsConnect Thank you for including me on your first Follow Friday
  • @thommck Thanks for the feedback - I was surprised by that one myself but it seems to be popular!
  • @mbullock Thanks Malcolm - have to admit one of the other other club members set up the lights but I was quite pleased with the shots!
  • [flickr] My first attempt at studio portraits: http://bit.ly/azkw5G
  • No new integration components for non-XP systems to run on Windows Virtual PC without hardware assistance: see http://bit.ly/bV0sA2

Calendar

August 2008
M T W T F S S
« Jul   Sep »
 123
45678910
11121314151617
18192021222324
25262728293031

Archive

Installing PHP 5 on IIS 6

Written by: Mark Wilson

I’ve run PHP with Microsoft Internet Information Services (IIS) before (running on a Windows XP laptop) and I seem to remember the installation being quite straightforward. Even so, tonight I was installing PHP 5.2.6 with IIS 6 (on Windows Server 2003 R2 Enterprise x64 Edition) and I ran across a few issues. This post describes what was involved:

  • Firstly, PHP can be installed in CGI, FastCGI or ISAPI mode. I used ISAPI.
  • Secondly, there is anecdotal evidence that the Windows Installer version is problematic – for that reason you may prefer to use the ZIP file and perform a manual installation (as I did), following the instructions on the IIS Admin blog, which were:
    • Extract the files to a location of your choice (I used C:\PHP to keep it simple but C:\Program Files (x86)\PHP would be better).
    • Rename php.ini-recommended to php.ini.
    • Edit the extension_dir line in php.ini to read extension_dir = C:\<em>phpinstallationfolder</em>\ext.
    • Add the PHP installation folder to the %path% system variable (e.g. append ;C:\PHP to the existing path).
    • Create a web service extension for PHP using cscript iisext.vbs /AddFile c:\<em>phpinstallationfolder</em>\php5isapi.dll 1 PHPISAPI 1 “PHP ISAPI”. The new extension should show in IIS Manager with a status of Allowed.
    • Create an application extension mapping for .php files. Following the advice on the IIS Admin blog article that I referenced previously will remove all other mappings so I used the IIS Manager MMC instead (Default Web Site Properties, Home Directory, Configuration to add a mapping to the executable at c:\<em>phpinstallationfolder</em>\php5isapi.dll using extension .php for all verbs).
    • Create a test file called phpinfo.php containing &lt;?php phpinfo(); ?&gt;.
    • Use a web browser to navigate to http://servername/phpinfo.php and the PHP information page should be displayed.
    • If you are running on 64-bit Windows there are some extra steps in order to avoid an HTTP 500 Internal server error or the message %1 is not a valid Win32 application. It seems that this is caused by trying to load a 32-bit application (in this case PHP) inside a 64-bit worker process (as described in Microsoft knowledge base article 895976). To resolve this issue, enter cscript adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1. adsutil.vbs is one of the scripts installed into the wwwroot\AdminScripts folder but if you have removed it to secure the server (as I had), then it may be temporarily copied back to the server from another IIS installation.
    • To ensure that PHPinfo reflects the correct location of the php.ini file, create an environment variable called PHPRC referring to c:\phpinstallationfolder and restart the server or, alternatively, set the appropriate registry keys (although neither option seemed to have any effect for me).

Comments

1

Comment from Tim Anderson
Time: Thursday 7 August 2008, 14:08

Why not FastCGI, which is meant to perform much better?

Tim

2

Comment from Mark Wilson
Time: Friday 8 August 2008, 0:28

Hi Tim – good to hear from you.

There was certainly no scientific reason behind using ISAPI, except that the PHP website warned me off CGI (for security reasons) and I wasn’t sure about the FastCGI support on IIS6 (I know it is a major improvement in IIS7).

To be honest, performance wasn’t my main concern (I was only looking for something quick and simple to host the code for the Cisco IP Phone-Active Directory integration that I’ve been working on this evening). Your comment has prompted me to have a look at the FastCGI extension for IIS6 some day but, at the time, adding another component to the mix would have been creating another level of complexity!

All the best, Mark

3

Comment from Anonymous
Time: Tuesday 23 September 2008, 15:54

all the config guides hav given the same solution and my .php files won’t run.I have IIS 6.0 and have installed php 5.2.6 (noticed the php.exe only opens in dos mode an the win version didn’t even start)How do I override existing settings that may be affecting new ones applied?
Dan

4

Pingback from markwilson.it » Customising a Cisco 79xx IP Phone: directory services
Time: Thursday 17 September 2009, 16:20

[...] up, you need a web server with PHP installed (I used PHP 5.2.6 on IIS 6.0). This also needs the LDAP extension to be enabled by uncommenting extension=php_ldap.dll in [...]

Write a comment

Please note the rules for comments and the privacy policy and data protection notice. I'm sorry but, because not everyone sticks to the rules, I've had to implement some spam prevention measures - if you're experiencing difficulties leaving a comment, please let me know.





The following XHTML tags may be used: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>