2. A Little History
2006 • PHP on Win/IIS = Big Joke
2007 • IIS FastCGI
2008 • windows.php.net
• PHP 5.3
2009 • PHP 5.3 Release
• WinCache 1.0
2010 • FastCGI 1.5
• WinCache 1.1
3. PHP Community and Microsoft
• “PHP on Windows” project involves:
– PHP core developers
– PHP installer developers
– PHP documentation team
– PHP community and influentials
– PHP applications communities (WordPress,
Joomla, Drupal, others)
– Many others…
5. CGI vs FastCGI
• (CGI on Windows) == SLOW !!!
– New PHP process per request
• FastCGI == (CGI on steroids)
– Re-use PHP processes in a process pool
– Single-threaded execution environment
– Use Non-Thread Safe PHP with IIS FastCGI
• PHP ISAPI?
– Stay away!!! Use FastCGI instead
– No ISAPI support in 5.3 anyway
8. FastCGI 1.5
• New features:
– Auto-tuning of maxIntances for optimal performance
– Automatic recycling of PHP processes with config
change MonitorChangesTo setting
– No more restarts with changes to php.ini
• Consistent set of features across all IIS versions:
– For IIS 7.5 in WS08 R2 – new features are included
– For IIS 7.0 in WS08 – install the FastCGI update
(http://www.iis.net/expand/FastCGI)
– For IIS 5.1 & 6.0 – install FastCGI 1.5 extension
9. IIS FastCGI and PHP Setup - automated
• Use the easiest option - Web Platform Installer!
Get Web Platform Installer from http://www.microsoft.com/web/php/
13. PHP 5.3 improvements
• PHP 5.3 improvements:
– Using VC9 compiler (PHP 5.2 used VC6)
– Optimized API calls (using Win32 instead of POSIX)
– All PHP libraries built from the source code
– Compatibility fixes
• Windows builds are available at:
– http://windows.php.net/
From: http://ilia.ws/files/Confoo2010_PHP53.pdf
“Substantial performance improvements on Windows (40% +)”
15. WinCache 1.0
• PHP Accelerator optimized for Windows
– Opcode cache
– File cache
– Resolve path cache
• Download from:
– http://www.iis.net/expand/WinCacheForPhp
• Contributed by MS to PECL:
– Source code on http://pecl.php.net/wincache/
– Documentation on http://www.php.net/wincache/
– BSD license
Contributions are welcome!
16. Why use opcode cache?
To serve an index.php in WordPress, PHP has to read, parse, compile and
execute more than 100 PHP files!
17. WinCache in action
Just add extension=php_wincache.dll in php.ini.
No app code changes necessary!
18. WinCache and CPU usage
• WinCache significantly
reduces CPU load
• Use FastCGI
maxInstances setting to
load CPU more
• Set maxInstances to 0
to enable auto tuning
19. WinCache and CPU usage
Increased FastCGI maxInstances from 4 (default) to 10
20. WinCache 1.1 User Cache API:
• Stores app data in shared memory
• Function by function compatible with APC
21. WinCache 1.1 – Session Handler
• Stores PHP session data in shared memory
• Enabled in php.ini :
session.save_handler = wincache
• Session storage is not persistent in beta, but
will be in RC:
– Use the code snapshot to try it out.
22. WinCache 1.1 user cache in action
Instructions on how to configure WordPress to use WinCache user cache:
http://ruslany.net/2010/03/make-wordpress-faster-on-iis-with-wincache-1-1/
24. What’s next?
• Popular PHP applications to adopt WinCache:
– Joomla 1.6
– Drupal cacherouter module
– Sugar CRM
• WinCache improvements:
– File change notifications support
– Function hooks
25. Summary
• In 3 years Windows/IIS has become a great option
for hosting PHP applications
• In 2 years the PHP performance on Windows has
improved considerably.
26. PHP on Windows - Contacts
• Pierre Joye
• Venkat Raman Don
• (PHP Core Developer)
– pajoye@php.net
• (IIS and WinCache Tester)
– donraman@microsoft.com
– http://twitter.com/PierreJoye
– http://blogs.iis.net/donraman
• Mark Brown
• Kanwaljeet Singla
• (Web Platform)
• (IIS and WinCache – twitter.com/markjbrown
Developer) – blogs.msdn.com/markbrown/
– ksingla@microsoft.com
– http://twitter.com/kjsingla
• Ruslan Yakushev
– http://blogs.iis.net/ksingla/ • (IIS Program Manager)
– ruslany@microsoft.com
– http://twitter.com/ruslany
– http://ruslany.net/
27. PHP on Windows - resources
• http://windows.php.net/
• http://php.iis.net/
• php.windows mailing list
• http://forums.iis.net/
28. Test setup
• Quad core CPU + 4 GB RAM
• Windows Server 2008 with IIS 7.0 and FastCGI
• PHP 5.3.2
• WinCache 1.1 beta
• WordPress 2.9.2
• + Load Generator and MySQL on the same box