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.
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.
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.
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.
Jim Cheshire is an expert on Expression Web and ASP.NET and is the owner of Jimco Software and Books. Jim has been employed by Microsoft for over 10 years and is currently a senior escalation engineer on the ASP.NET and IIS teams. You can reach Jim at one of his websites, www.jimcosoftware.com or www.jimcobooks.com.
Jim's latest book, Microsoft Expression Web 3 In Depth, has been selected as Microsoft Subnet's October, 2009, book-giveaway.
Read a chapter excerpt of Microsoft Expression Web 3 In Depth, hosted exclusively by Microsoft Subnet.
To enter the monthly giveaways, visit the Microsoft Subnet home page for entry form information.