IIS FastCGI support in Sugar 5.5

sugarcrmdevelopers —  June 11, 2009 — 3 Comments

One of the most exciting features for those deploying Sugar on Windows stacks is the offical support for the new IIS/FastCGI support of PHP. This promises to bring great performance and stability boosts as compared to using the previous ISAPI method of using PHP.

What is FastCGI?

There has for sometime been two popular ways of using PHP with Microsoft’s IIS ( Internet Information Server ); either you could use the ISAPI hook which runs PHP in the same process as IIS, or CGI support which runs it in a seperate process. Both approaches had thier drawbacks; running PHP in ISAPI mode required thread-safety, which although PHP was reasonably good at, the many libraries PHP uses aren’t. So using CGI was the natural choice to help your web server avoid crashing, but it had the flaw of being very slow since each PHP request would have to spawn off a whole new PHP process. This made deploying on Windows something nobody would do for anything but the smallest web applications.

Microsoft fixed this issue by adding a FastCGI mode to IIS 7 ( and backwards to IIS 6 and 5.1 via an add-on ). The FastCGI appoach is similar to the CGI approach where PHP handles the requests externally from the IIS process. But instead of launching a new process each time, IIS instead pools them, saving the overhead costs of launching and destroying processes on every request. This results in a significant improvement in speed compared to CGI ( around 4x-8x on average ) and little to no stability issues unlike with ISAPI. Both PHP and Microsoft are putting lots of effort into improving stability on FastCGI as well, making deploying production web applications on a pure Windows stack a reality.

This sounds great! Now, what do I need to do?

Microsoft has dedicated instuctions for setting up PHP to work with IIS 6 and IIS 7, and the new Microsoft Web Platform Installer 2.0 Beta will also configure PHP correctly. In addtion, the PHP Windows Installer will configure PHP correctly with IIS 5.1,6, and 7; be sure to use the NTS ( Non thread safe ) binaries, as they will yield better performance than the standard thread safe ones since we don’t need thread-safety when using FastCGI.

We recommend changing a few of the default setting for FastCGI and PHP when using the IIS/FastCGI support. First, with FastCGI ( which can be changed in the fcgiext.ini file for IIS 5.1/6 and in the FastCGI panel in IIS 7 when you have installed the IIS Admin Pack ):

ActivityTimeout – change to 3600, which is the maximum value

RequestTimeout – change to 3600, also the maximum value

Those settings will allow IIS/FastCGI to not interfere with the PHP max_execution_time/request_timeout settings.

On the PHP side, be sure the following settings are set:



These help prevent wierd FastCGI errors and improve security for your Sugar instance.

If you are on IIS 7, you will need to install the URL Rewrite extension, which provide .htaccess like directory security for your Sugar install.

Once that is done, you should be ready to go. If you run into any issues with using IIS/FastCGI, just let us know.

3 responses to IIS FastCGI support in Sugar 5.5


    Great article. Quick question what is the solution(s) available for opcode caching on NTS PHP 5.3?

    We found than TS PHP is faster WITH eaccelerator opcode cache than NTS PHP on its own.

    Any suggestions?


    Great article. Quick question what is the solution(s) available for opcode caching on NTS PHP 5.3?

    We found than TS PHP is faster WITH eaccelerator opcode cache than NTS PHP on its own.

    Any suggestions?

Trackbacks and Pingbacks:

  1. Sugar Developer Blog » Blog Archive » SugarCRM now in the Windows Web App Gallery - July 29, 2009

    […] to this blog for more information on this ). Also for 5.5 we’ve added full support for using FastCGI under IIS, which should bring performance and stability improvements to all Windows users, and in the process […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s