Article in Hosting & Security

PHP CGI or PHP ISAPI with IIS?

By Matthew

Released On 02-09-2007

If you’re a windows host, or even used a windows server host, then I’m sure you’ve have to make a decision regarding PHP. Yes it’s true that most PHP users are usually using a Linux based distro, but as web technologies advance, it’s becoming more and more common for Windows host to install and utilize a cross breed of technologies such as ASP.NET, Python, PERL, and PHP. So instead of just utilizing Access Databases, and ASP, you can build a site utilizing asp for part of your site, and cross technology php for another portion.

Some of the previous argument about using PHP on IIS previously, where issue’s of stability and or speed on IIS. With the advent of IIS 5 and 6 and greater scripting technologies, most of these issue’s have been completely worked out, making PHP on IIS a viable option. PHP can be installed on a windows server a couple of different ways.

PHP supports two different types of interfaces. CGI and ISAPI, both of these can be used on IIS. Most people will tell you that using PHP in CGI Mode is better than the ISAPI mode load, but I have found ISAPI to run very stable on heavy traffic sites that I manage, most times it is always better than the CGI binary, unless you are running IIS 4 which does not do very well running the ISAPI version of PHP.

So for ease of use the CGI version may be the better option, but for stability I personally recommend the ISAPI version. There are actually even issues with some applications running PHP on IIS in CGI mode. Some of the common issue’s you may run into are CGI Timeouts, which can be adjusted by extending the amount of time you can take to execute CGI scripts.  Another difference in the CGI and ISAPI modes are, ISAPI is compiled and hooked into the server at load time, therefore it tends to be faster, and more robust, while PHP in CGI mode needs to be loaded then unloaded every time a call is made for it. In my opinion PHP in CGI mode should be more of a last resort option, especially if you’re using a strong Information Server such as version 5 or 6.

A few tips when setting up your server to run PHP in ISAPI mode.

Don’t use the php installer from the php.net site. It’s easy to use yes, but it will most certainly install php in CGI mode, utilizing the php.exe file and not the phpisapi.dll file.

Download the latest stable version of PHP and the PECL extensions. Extract the contents of the PHP zip into any directory of your choosing. (I prefer c:\php) Extract the contents of the PECL extensions into the ext directory you just created for PHP.

There are a few great articles on getting your php installed and running correctly, one I’d highly recommend would be http://www.peterguy.com/php/install_IIS6.html.

I hope this is helpful, and helps you in your decision on using PHP on IIS

This article has 3 comments

Comment By The Oracle

posted on 03-10-2007 at 09:15 AM

Agreed

Comment By chopper

posted on 03-10-2007 at 12:50 PM

I don't agree about NOT using the PHP installer from php.net. It asks you if you want to install PHP as CGI or ISAPI, works really well.

Also the whole CGI argument stems from older versions of PHP when the ISASP extension DLL supplied was particularly unstable. ISAPI is definitely the way to go and I'd be willing to bet the CGI option might soon become an obsolete option.

Comment By bmr

posted on 03-14-2007 at 03:46 PM

I use wamp server. Installs and works great.

Comment By anthonylrm

posted on 07-08-2007 at 01:51 PM

i user php mysql. download the package from Appserv

Comment By soulf2

posted on 10-05-2007 at 03:23 PM

Verio appears to have both installed. They have an option to switch between ISAPI and CGI:
verio.com/support/documents/view_article.cfm?doc_id=6520
I signed up for one of their demo accounts (signu1.sslcert11.com/RequestSignupInvitation.aspx) and found that I could use CGI and ISAPI at the same time if I mapped different extensions (*.php to ISAPI and *.php5 to CGI)

Comment By mytthh

posted on 01-09-2008 at 06:16 AM

if you had a apache it would be easier now you must look for at google

 

Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com
Web Templates | Text Link Brokers | Stock Photos


     
RSS Feed  Feeds: RSS   JS   XML