Do it yourself web and tech tips

Installing ISAPI PHP and MySQL on Server 2008

Most commonly, PHP is installed on Windows Server 2008 using the FastCGI method. FastCGI is considered more stable on Server 2008 and, generally, less problematic (if you do a bit of research). On the other hand, I’ve used an ISAPI PHP installation on Server 2008, for a long time, with no serious problems. I chose to use ISAPI PHP simply because it’s the method with which I’m the most familiar, and, because it’s significantly faster than the FastCGI version.

Which versions of PHP and MySQL you use are at your own discretion. Purely for the sake of convenience (mostly, my own) you can download the packages I am using right here: PHP 5.2.5 and MySQL 5.1.53.

One Issue

While I’ve seen numerous how-tos around the web for doing this installation I’ve not seen any which mention the following issue. And I have never installed the ISAPI version of PHP on Windows Server 2008 and not seen this problem. It may, however, have something to do with the version of PHP which I’m using (version 5.2.5). I may tinker with a different version and eventually update this page. But you should be aware that, using some versions of PHP (at least) your server will throw the following error with regularity:

iis wroker process error %photo

This bug has been replicated and it is very well documented, here:

https://bugs.php.net/bug.php?id=44047

Again: it is entirely possible that this can be avoided by using an updated version of PHP. While this page offers certain packages for download you can, obviously, tinker with the components (perhaps avoiding this problem).

The Workaround

This error can easily be eliminated although, in the view of some IT people, the workaround comes at the expense of some server efficiency. All I can say is this: I have never found that the following causes any problems, at all. You, of course, can do some further study and make your own decision. However, to rid of this error do the following

Go the advanced settings, in the application pool, and configure the following:

Set Idle timeout to ’0′

Set Disable Overlapped Recycle to ‘True’

Installation

The following presumes, of course, that you have Server 2008 installed and that you have added both the IIS and Application Server roles.

  1. Install MySQL – Again, you can use which ever version you feel best suits your needs. Though I’ve already provided a link, above, you can download MySQL version 5.1.53 here. This page presumes that you have installed MySQL previously, and, detailed configuration notes for your MySQL server are beyond the scope of this page. Having said that, however, most people will simply need to (1) set MySQL to run as a service, and, (2) set a password which they can remember. A basic MySQL installation is very straightforward. Just double-click and follow the prompts.
  2. Install PHP – similar to the above, you can use whichever version of PHP suits your needs. However, you can download PHP version 5.2.5 here. Once your download is complete, unarchive the .zip file and copy the php folder to C:\php
  3. Edit php.ini – For reasons I actually cannot recall at the moment, I like to have short tags enabled in php.ini. And, as I recall, short tags are not enabled when this zip file is unarhived. So, this is really just a note to myself to go to C:\php\php.ini and enable short tags. ALSO: there are numerous other settings in php.ini which determine how your installation of PHP will perform (eg. which modules should be loaded, timezone, maximum upload size – and on and on). Obviously, you’ll now want to review some settings and tweak the php.ini file to reflect your preferences.
  4. Copy php.ini – Once you’ve edited the php.ini to your liking you need to copy the file to C:\WINDOWS\php.ini. While anyone who knows what they’re doing will tell you that it’s unnecessary, I also copy php.ini to C:\WINDOWS\system32\php.ini. This is absolutely my own, oddball habit and everything should work with php.ini copied simply to your Windows directory. I started doing it once, when IIS wouldn’t load PHP, and I’ve done it ever since. It won’t hurt anything, but, you really shouldn’t have to do this.
  5. Copy .dll files for MySQL – Go to the C:\php\ext folder and copy
    the php_mysql.dll and the php_mysqli.dll files to the C:\WINDOWS directory and to C:\WINDOWS\system32 directory. In the upper level of of the php folder (C:\php) find the libmysql.dll and copy it likewise (to C:\WINDOWS and C:\system32).
  6. Create a registry entry for PHP – We need to add a registry entry for PHP, and I’ve always found fiddling with the registry a bit tedious. For my own convenience I am posting a link to download the edit – a file which can be clicked to simply add this information to the registry. For the sake of time, I would recommend simply downloading this pre-configured registry edit and double-clicking it, thereby adding if to your registry.
  7. FYI: The registry entry, above, writes the following – skip these steps if you’ve used my download….

    • 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
  8. Add PHP to the environmental path
    • Click on Start => Settings => Control Panel and double-click the System icon (using the class view).
    • Click on the Advanced system settings link from the left column.
    • From the System Properties window, click on the Advanced tab, and, then click the Environment Variables button at the bottom. Select the Path variable from the System Variables section and click “Edit”. At the end of the string add the following:;C:\php
      Don’t forget to separate your new entry from with a semi-colon, at the beginning.
  9. Configure Handler Mapping/Script Map
    • Open the IIS Manager and select your server
    • Click the Handler Mapping icon, then, click Add Script Map
    • Add the following values, from top to bottom: *.php > C:\php\php5ispai.dll > and use “PHP-ISAPI” for the name
    • Click again on your server’s hostname, again, and from the left panel and double-click on the ISAPI And CGI Restrictions icon.
    • From the Actions panel on the right click on “Add”
    • NOTE:You may find that a rule for the PHP module already exists, but with no name. In that case, simply add the name “PHP”. If it does not exist add the following thulsy, from top to bottom: C:\php\php5ispai.dll > PHP.
  10. Click on your server’s hostname from the left panel and double-click on the Default Document icon.
  11. Click on “Add” from the actions panel on the right.
  12. Enter index.php in the new default document name and click on OK. I’m new to IIS – as I recall, this has to be done for every site
    (I can’t recall with certainty)

Okay – you should be all done. Now you can proceed to test your server. If you added the Application Server Roles your new server will display a wide variety of pages – including .asp, .aspx, and .php. I like to test everything by throwing a few pages on the server of various types. In fact, I keep some example in a zip file, which you can download here, if you want to use them. The .asp page is actually a copy of the GoDaddy home page. These pages are simply an easy way to make certain that everything is being parsed, and displayed, “according to plan”.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

admin On August - 16 - 2012

Categories

Uncategorized, Windows

Tags

Related Posts

  • No related posts found

Leave a Reply


Anti-Spam Quiz:

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube
No public Twitter messages.
cern

CERN celebrates birt

The WWW: not unlike the invention of the wheel It was ...

paginate

What's pagination -

What is Pagination? We’ve all heard the phrase, often spoken as ...

swartz

Aaron Swartz: RSS in

Tech Genius Aaron Swartz, dead at 26 On Friday, January 12th ...

no_public_twitter_messages

No public Twitter me

Have your Twitter feeds flown the coup? Unlike Facebook, which tweaks ...

the_power_of_html5

HTML5: The Web Refin

From Bulletin Board Services to HTML 5 I first experienced the ...