First: installing ISAPI PHP is not recommended by Microsoft. I prefer it to FastCGI, however, and this is how I went about installing PHP, MySQL (and WordPress) on IIS 7. I’ve just decided to include some incidental notes on WordPress as part of this page. NOTE: I had originally followed a tutorial I’d found on the web to do this, and, my experience differed (minorly) at one point from the directions I’d found. That difference is noted in the steps, below.
- IIS 7 on server 2008
- PHP 5.2.5
- MySQL 5.1.53
There is an issue with ISAPI php on Server 2008. When a php page has has been loaded, and after only a brief period of time, the server throws an error which looks like this:
There really is no “fix”. The imperfect workaround is to go the the relevant application pool and set the following in the advanced settings:
Idle timeout is set to ‘0’
Disable Overlapped Recycle is set to ‘True’
- Obviously, add the IIS and Application Server roles.
- Install MySQL – you can download it here. This is version 5.1.53. Use whatever options you desire. It’s very straightforward.
- Download php-5.2.5 (zipped format) here, unarchive the directory and copy it to C:\php
- I don’t believe this edit is included in the above download: open C:\php\php.ini and enable short tags.
- After you’ve made the above edit copy php.ini to both C:\WINDOWS, and, C:\WINDOWS\system32 (this is overkill – we’re gonna make sure this bugger works).
- Go to the C:\php\ext folder and copy the php_mysql.dll and the php_mysqli.dll files to C:\WINDOWS and to C:\WINDOWS\system32. In the primary php folder find libmysql.dll and copy it to the same places…..
- We need to create a registry entry for PHP and I don’t like horsing around, doing this stuff manually. I would recommend just downloading this pre-made registry edit
and double-clicking the thing. I’ve included instruction for doing it manually, below – just skip them if you’ve edited your resgistry with this file.
REGISTRY EDIT (SKIP TO STEP 8 IF YOU’VE DONE THE PRECEDING STEP)
- Run regedit and create a new key named PHP, under HKEY_LOCAL_MACHINE\SOFTWARE\
- Right-click on the newly created key and select New => String Value
- Name the new value IniFilePath and set the value data to C:\php
Don’t forget to separate your new entry from with a semi-colon, at the beginning.
The following step if the point at which my experience differed, minory, from a web guide I’d read.
When I reached this point and tried to add this module I received a pop-up stating that a rule for this module already existed. I looked, and one existed – but it had no name. I simply renamed it to “PHP”.
I would reboot and do some testing. I’ve got a zip file for download that includes a php info page, an .aspx page, etc. that are handy to make sure everything is parsing (the .aspx page is the GoDaddy home page, by the way). You can download some test pages here
Wordpress wouldn’t write a configuration file until I granted “Users” write permissions on the wwwroot directory. I had some issues with the “format” drop-down menu in the visual editor, and, also found that some .flv players which worked in IIS 6 did not work in IIS 7 (and vica versa). Also, a math quiz plugin for combatting SPAM, which worked in IIS 6, did not work in IIS 7. Here’s a short list of plugins that worked fine – this is something I really need to organize and put in it’s own post:
FLV EMBED – one of two flv players I tested which works (the HANA flv player kept looping and the Flowplayer just didn’t work at all). The directions for it’s usage are a bit ambiguous. You need to go into the admin panel and go to the settings area. Tick the box to allow “poster” images, and, check which file type it accepts – it only accepts one. The name of the image has to be the same as the flv file – and they have to be in the same folder (ugh!). It’s weird. The following code worked – but, supposedly, you can point the thing to a preview image with a URL and I can’t make that work:
WP-OS-FLV – This is another .flv player which worked fine, and, which was something I’d never seen before. To save a bunch of typing, the working embed code looked like this:
Block-Spam-By-Math – this is a SPAM blocker – a math quiz – that worked when my old one failed.
TinyMCE Advanced – Just a jazzed up editor…..
Audio Player – This is the simple little mp3 player I use on this site…..works great. By the way, if you get an error that flash isn’t installed – and you know that it is – your theme probably needs the following in the footer.php file, right before the closing body tag:
UPDATE 2016 (JUNE)
For no reason in particular, last night I wanted to fiddle around installing IIS7 and Exchange on Windows Server 2008 – with ISAPI PHP and WordPress. I’ve never had a problem with PHP, before, but I had a helluva time getting Windows to read the php.ini file. I ended up doing about four things, which I’d never had to do before. Here are some quick notes. By the way, the last version of PHP which includes php5isapi.dll is php-5.10 – you can download it here, for 64bit. Anyway – all of this not be required, but this is what I did which eventually worked:
- Copy php to C:\php – edit php.ini.distribution to your taste and save it as php.ini. My own, edited php.ini is displayed further down this page.
- Copy all of the MySQL “lib” .dlls, and, all of the .dlls in C:\php\ext folder to C:\WINDOWS\system32.
- Copy your edited php.ini file to C:\WINDOWS. Conventional wisdom says you should delete the original – I left it in C:\php.
- Add both C:\php and C:\php\ext to the PATH.
- Set the permissions of C:\WINDOWS\php.ini to include liberal permissions for IUSR.
- After getting everything set, refresh the Default Application Pool.
- Of course, add *.php as as an allowed extension, and, as a document.
- Give read/write permissions to IUSR and IIS_IUSR on C:\WINDOWS\Temp – or WordPress will not download updates. I also create a file called “tmp” in the C:\php directory, and, one in the Windows directory (with the same permissions).
- WordPress – and any other PHP script involving uploads – will be limited to an upload size which is determined by IIS, irrespective of your PHP configuration. There is a web.config file in your site’s home directory which should look something like the following (I’ve set the upload value to “900000000”):
- Here is an entire page which give more detailed instructions on increasing upload limits in IIS 7.
- There are some new challenges associated with installing WordPress on IIS 7, which I’d never seen before (June, 2016) – they are explained below.
Three new, big, WordPress issues
ONE: The latest WordPress release would not install. Two nights ago I tried this installation and the WordPress installer ran fine. Tonight, I screwed around with this thing for 3 hours and had almost decided that I was never going to get it installed. I couldn’t think of anything that I was doing differently. Then – late in the evening – it occurred to me that I had, previously, installed an older version of WordPress and updated to the latest release. It seemed very unlikely to me that this was the problem. I was wrong – that, apparently, was the problem. You can download the one that worked – WordPress-3.3.2, here……..WHEW
TWO: Wordpress will not update without the following at the bottom of your wp-config.php file:
add_filter('https_ssl_verify', '__return_false'); add_filter('https_local_ssl_verify', '__return_false');
THREE: On more recent versions of Server 2008 you need to grant liberal permissions to an additional user (along with IUSR and User). You must also give such permissions to IIS_IUSRS.
- Flowplayer DOES NOT WORK – use this: WP-OSFLV PLAYER.
[wposflv src="http://undivinerealm.com/wp-content/uploads/2016/06/multi.mp4" previewimage="http://undivinerealm.com/wp-content/uploads/2016/06/wordpress-multisite.jpg" width="600" height="400"]
Alrighty… For no reason, last night, in particular I installed Windows Server 2008 and IIS 7 with PHP and MySQL. Here’s the drill:
- Install the operating system
- Set a static IP
- Either turn you firewall off, or, tweak it to allow connection on port 80 (etc.)
- Install the Desktop Experience Feature.
- Install the Active Directory Domain Controller role
- Install the Application Server and IIS roles
- Download the stuff, below, and proceed
First: here’s a zip archive of PHP.INI that used to exist on this page as text – it’s one that I used for this installation – download it here. This php.ini file points to C:\tmp as the temporary upload folder – this directory it will need very liberal permissions.
WordPress specific: Also, you need to grant liberal permission to the IUSR (not the same as IIS_IUSR) on the wp-content folder, for WordPress.
- Download and install MySQL 5.5.16 – you can use the following batch file to log into MySQL:
@echo off echo Starting MySQL command line... cd "C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin\" mysql.exe --user=root --password=your_password
- PHP 5.3.10 for 64bit – Download this zip archive and copy to C:\
- Download this zip archive and copy it’s contents to C:\
- Download this zip archive and copy the contents to C:\WINDOWS and C:\WINDOWS \system32
- Edit the path variable and add C:\php
- Add the PHP handler to the server.
Okay… As noted, grant read/write permissions to both the IIS_IUSR and the IUSR on C:\tmp. You may need to add various mime types. Notably lacking is the mp4 mime type – just add .mp4 and video/mp4 in the appropriate boxes.
You’ll have trouble uploading large files if you don’t add the following lines to your web.config file (set the content length value to your desired size). There are some other tweaks you can make, to resolve upload size issues, but this has always resolved the problem for me: