Putt's law:
Technology is dominated by two types of people: those who understand what they do not manage, and those who manage what they do not understand. -- Archibald Putt
Recently Microsoft released its opcode
caching solution for PHP on Windows. On
techPortal we've published
a benchmark. In this article, I want to look at things from a manager's perspective.
As PHP extends its reach further into corporate networks, IT managers have yet another technology that they have to understand so that they can properly deploy. In many situations, PHP code is being developed that - running on its own - creates a bad user experience because of the nature of the language. Because each PHP script has to integrate and compile all of the files with code in them before the results can be output, the more complex systems get, the longer it can take for scripts to respond to their client. Much of this delay, and the user unhappiness that always accompanies it, can be mitigated with the proper opcode caching solution.
The list in this article was compiled to help managers understand what their options they have. These are the most popular or recent PHP opcode caching solutions.
Opcode caching, simply put, is storing the compiled PHP scripts in shared memory so that instead of reading from the disk and compiling each time, the pre-compiled script can be read from memory. If used properly, opcode caching can greatly improve the performance of most PHP scripts.
Opcode caching on Windows takes various forms. Depending on the web server and method you are using to deploy PHP. Benchmarking the potential solutions is beyond the scope of this document; we've covered some of that in our techPortal article. Readers are encouraged to be wary of most benchmarks and to instead setup and test each solution using their code and real-world loads.
The Alternative PHP Cache
The most popular opcode caching solution for PHP is APC, the Alternative PHP cache. APC is not yet a part of the core binary but is easily installed from PECL. APC works well on Windows if installed with Apache and mod_php. However, APC will not work with the newer FastCGI technology due to a conflict between how FastCGI manages memory and how APC manages it. APC will be built into the core of PHP starting with PHP 6.
Zend Optimizer+
Zend Optimizer+, Zend's opcode caching solution is now incorporated into both Zend Server and Zend Server CE. Readers who have selected Zend Server to deploy PHP, whether with Apache or IIS, already have caching installed, configured and enabled.
In addition to traditional opcode caching, Zend Server also offers full page caching. In many situations, this additional tool will increase an application's speed even more; however, they require changes to the PHP code to be able to use them.
WinCache
Until recently, if you were running IIS + FastCGI, there were no other options for opcode caching outside of Zend Platform/Zend Server. Realizing the hole in their stack and seizing the opportunity, Microsoft has recently released its own opcode cache for PHP, WinCache. WinCache was designed from the ground up to run on IIS + Microsoft's implementation of FastCGI and is not a port of another technology. In addition to opcode caching, WinCache also provides file system caching and relative path caching.
WinCache requires very little effort to get installed if you are using the Web Platform Installer and once installed and configured, most PHP applications will see a performance boost.
Conclusion
PHP on Windows has come a long way in the past few years. As you can see, when it comes to deploying PHP on Windows in a production environment, IT departments now have options that make it a viable solution for both low and high-volume sites. The right option is the one that fits your technical needs and best integrates with your existing technology stack.