How to Configure and Optimize the Microsoft Web Platform for PHP
By Tali Smith
November 15, 2009
There are various steps you can take to optimize Windows Server® 2008 R2 or Windows Server® 2008, Internet Information Services 7 (IIS 7) and above, and FastCGI performance for your Web workloads and PHP applications. These include:
- Use the Windows Cache Extension. The Windows Cache Extension for PHP is a PHP accelerator that is used to significantly increase the speed of PHP applications running on the Windows® operating system. PHP applications can take advantage of the functionality provided by the Windows Cache Extension for PHP without code modifications.
- Configure IIS 7 and Above Output Caching. This feature can cache dynamic PHP content in memory so that the script used to generate the dynamic output does not need to run for each request.See also Walkthrough: IIS 7.0 and Above Output Caching and Videocast: Improving Performance with Native Output Caching.
- Configure PHP Recycling Behavior. Make sure FastCGI always recycles the Php-cgi.exe processes before the native PHP recycling starts.
- Enable Per-Site PHP Configuration for PHP on IIS 6.0 and IIS 7 and Above. This feature is particularly important in a shared hosting environment, letting customers control PHP configuration.
- Configure SMTP E-Mail in IIS 7 and Above. Configure Simple Mail Transfer Protocol (SMTP) e-mail in IIS when you want to deliver e-mail messages from your site. Mail can be delivered immediately or it can be delivered to a file location on disk where it can be retrieved for delivery later.
- Create a Separate Site or Virtual Directory for PHP Content. Self-hosters or very small hosters may need create a separate site or virtual directory to host their PHP content on a system that is also used for other workloads.
Best Practices for PHP on the Microsoft Web Platform provides a summary of additional steps you can take, including:
- Configure PHP process recycling behavior
- Disable unneeded services and processes
- Optimize server performance
- Enable bandwidth throttling
- Use HTTP Keep-Alives
- Use HTTP compression
- Use Forms Authentication
- Manage IIS 7 and Above with the PowerShell Provider
- Extend IIS 7 and Above
- Use a non-thread-safe build of PHP
- Set the default document
- Use the URL Rewrite Module
- Use the Request Filtering Module
Discuss in IIS Forums