Microsoft Subnet An independent Microsoft community View more

Hosting PHP on Windows Makes More Sense than Ever

High-performance PHP applications are possible on Windows with Microsoft's latest innovations.

PHP has traditionally been considered a programming platform for Apache web servers. Part of the reason for this is that PHP performance on Apache has historically been better than on Windows servers. This is obviously a sitation that Microsoft would like to see change, and they have made significant headway in doing so recently with the release of FastCGI for IIS, the Windows Cache Extension for PHP, and support of PHP in Expression Web.

FastCGI for IIS

One of the primary reasons that PHP has been slower on Windows than Linux or Unix servers is overhead of spawning and tearing down the PHP process. The FastCGI feature of IIS alleviates that cost by maintaining a pool of PHP processes that can be reused for processing requests. The FastCGI extensions spins up these PHP processes automatically so that the cost of spinning up a process during the request is avoided. The 1.5 version of FastCGI is currently in beta and adds some great new configuration options.

Windows Cache Extension for PHP

The Windows Cache Extension for PHP provides performance boosts by caching in three key areas; PHP bytecode, PHP scripts, and path relationships.

Each PHP script is compiled into bytecode, and by caching the resulting bytecode, compilation is avoided for subsequent requests for the same page. The process of accessing these scripts is also a performance hit because the PHP process has to conduct file I/O operations. By caching the PHP scripts in memory, the Windows Cache Extension for PHP significantly reduces file system I/O.

Finally, if a PHP application uses relative paths, there is a performance hit incurred by the PHP engine because it has to resolve the relative path to an absolute path. By caching these path resolutions, the Windows Cache Extension for PHP requires only one resolution per path.

PHP Support in Expression Web

As of version 2, Expression Web has arguably better support for PHP than it does for some of Microsoft's own server-side technologies. PHP developers enjoy IntelliSense, color formatting, page templates, and even a local development server that can process PHP requests without the need for a full Web server.

One feature that Expression Web doesn't offer to PHP developers is PHP debugging. However, the free Aptana Studio offers additional features for PHP developers on Windows, including PHP debugging.

PHP is enjoying a lot of popularity, and while PHP developers looking for high-performance apps have been restricted to Apache on Linux or Unix-based systems in the past, the landscape is rapidly changing. If you're a PHP developer, you owe it to yourself to check out the features available on Microsoft's platform.

Join the discussion
Be the first to comment on this article. Our Commenting Policies