For the longest time, the utterance of "PHP" and "Windows" within the same sentence meant the speaker was either temporarily insane, or horribly misguided.
In 'An Oxymoron's Guide to PHP on Windows' you'll discover just how much the situation has changed in the past 12 months. Thanks to Windows Server, IIS7 and FastCGI, running PHP on Windows finally makes a great deal of sense. It performs admirably and facilitates integration with familiar Microsoft technologies like ASP.net and Silverlight.
Join Tim Keller (@timkeller) for a technical, yet light-hearted, talk about this and more.
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
An Oxymoron's Guide to PHP on Windows
1. An Oxymoron’s guide to PHP on Windows
Tim Keller
Lead PHP Developer
Umoya Networks
t/
@timkeller
e/ tim@umoya.net
2.
3.
4.
5.
6.
7. An Oxymoron’s guide to PHP on Windows
Tim Keller
Lead PHP Developer
Umoya Networks
t/
@timkeller
e/ tim@umoya.net
8. www.umoya.net
Hi, I’m Tim Keller I do PHP for a living
9. Oxymoron. Thanks Wikipedia.
An oxymoron (plural oxymora (greek plural) or, more often, oxymorons)
("sharply dull" in Greek) is a figure of speech that combines normally
contradictory terms.
An Oxymoron’s Guide to PHP on Windows.
OR, BUT HOPEFULLY NOT,
A sharply dull Guide to PHP on Windows.
10. The plan
• Quick intro
• History of the oxymoron
• Setting PHP on Windows
• Microsoft Web Platform Installer
• Using ASP.NET AJAX with PHP
• Silverlight with PHP
• Windows Cache Extensions for PHP
• PHP for Azure
13. PHP:
Personal Home Page
by Rasmus Lerdorf in
1994
Wanted to get his CV
online, and see how
many users viewed it.
So he wrote a
programming
language.
17. PHP 3:
Zeev Suraski and
Andi Gutmans get
involved.
PHP - a reverse initialism
PHP: Hypertext Preprocessor
Founded Zend Technologies and
rewrote the parser which forms
PHP 4 (May 2000).
Released PHP 5 in 2004.
PHP 6 is “in progress”
24. Running PHP on Windows (using IIS)
CGI
Invokes a new
php.exe process for
each request
Advantage
• Very stable
Disadvantage
• SLOW due to I/O
overhead of Process
Creation on Windows
25. Running PHP on Windows (using IIS)
CGI
Invokes a new
php.exe process for
each request
Advantage
• Very stable
Disadvantage
• SLOW due to I/O
overhead of Process
Creation on Windows
26. Running PHP on Windows (using IIS)
CGI ISAPI
Invokes a new
php.exe process for
each request
Advantage
• Very stable
Disadvantage
• SLOW due to I/O
overhead of Process
Creation on Windows
27. Running PHP on Windows (using IIS)
CGI ISAPI
Invokes a new PHP Loaded as an
php.exe process for extension in IIS’s
each request memory space
Advantage Advantage
• Very stable • Better performance
Disadvantage Disadvantage
• SLOW due to I/O • Not very stable
overhead of Process • Many PHP (PECL)
Creation on Windows extensions are not
Thread-Safe
28. Running PHP on Windows (using IIS)
CGI ISAPI
Invokes a new PHP Loaded as an
php.exe process for extension in IIS’s THE OXYMORON
each request memory space
Performance
Advantage Advantage
• Very stable • Better performance vs.
Disadvantage Disadvantage
Reliability
• SLOW due to I/O • Not very stable
overhead of Process • Many PHP (PECL)
Creation on Windows extensions are not
Thread-Safe
29. Timeline
• Since the dawn of time
PHP on Windows IIS is miserably bad.
• 2006
Zend and Microsoft announce collaboration
• 2007
Zend and PHP Core Devs start optimising PHP 5.2.x builds for
windows.
• 2008
MS release IIS7 with native FastCGI for PHP.
FastCGI extensions for IIS6 released.
30. Running PHP on Windows (using IIS)
CGI ISAPI
Invokes a new PHP Loaded as an
php.exe process for extension in IIS’s
each request memory space
Advantage Advantage
• Very stable • Better performance
Disadvantage Disadvantage
• SLOW due to I/O • Not very stable
overhead of Process • Many PHP (PECL)
Creation on Windows extensions are not
Thread-Safe
31. Running PHP on Windows (using IIS)
CGI ISAPI FastCGI
Invokes a new PHP Loaded as an Process caching and
php.exe process for extension in IIS’s pooling mechanism
each request memory space
Advantage
Advantage Advantage • Faster than CGI
• Very stable • Better performance • More Stable than
ISAPI
Disadvantage Disadvantage • Can run non-thread-
• SLOW due to I/O • Not very stable safe versions of PHP
overhead of Process • Many PHP (PECL) and PECL extensions
Creation on Windows extensions are not
Thread-Safe
32. How FastCGI makes PHP on IIS awesome
FastCGI
Process caching and
pooling mechanism
Advantage
• Faster than CGI
• More Stable than
ISAPI
• Can run non-thread-
safe versions of PHP
and PECL extensions
33. How FastCGI makes PHP on IIS awesome
IIS 7.x Worker Process
Request
Read
FastCGI
queue
Process caching and
Authenti
ASP.NET
Authoriz pooling mechanism
Map
Static FastCGI Advantage
Handle handler
• Faster than CGI
Send
• More Stable than
Log ISAPI
• Can run non-thread-
safe versions of PHP
and PECL extensions
4 5
Pool of PHP 4 Pool of PHP 5
binaries binaries
34. Tuning FastCGI
• Loads of runtime parameters.
• Maximum FastCGI instances
C:WindowsSystem32inetsrvconfigapplicationHost.config
<fastCgi>
<application fullPath="C:PHPphp-cgi.exe" maxInstances="32">
</application>
</fastCgi>
35. Timeline
• 2008
MS release IIS7 with native FastCGI for PHP.
FastCGI extensions for IIS6 released.
Microsoft’s Pierre Joye and the PHP community conduct major
work on the PHP 5.3 codebase.
• Fixed 60+ Windows-specific bugs
• Updated every library to latest version
(some were 10+ years old)
• Compiled with VC++ 9 (VS 2008)
• x86 and x64 builds for Windows
39. Microsoft Web Platform Installer
• Simple, yet powerful installer for:
• PHP and ASP.NET binaries,
• PHP and ASP.NET 3rd party apps.
• Available at http://www.microsoft.com/web
42. What is AJAX?
• Asynchronous Javascript and XML (or JSON, HTML, text...)
• Sometimes: Dynamic HTML, Partial Page updates, Rich Internet Apps.
Traditional Client/Server AJAX Paradigm
User Interface User Interface
Request Response Ajax Engine
Web Server Web Server
43. ASP.NET AJAX
• A libraries in three parts:
• MS AJAX Library
Javascript files for the browser
• ASP.NET AJAX Extensions PHP MS AJAX library on Codeplex
Server-side ASP.NET code http://codeplex.com/phpmsajax
• ASP.NET Ajax Control Toolkit
Shared-source components
44. ASP.NET AJAX
• A libraries in three parts:
• MS AJAX Library
Javascript files for the browser
• ASP.NET AJAX Extensions PHP MS AJAX library on Codeplex
Server-side ASP.NET code http://codeplex.com/phpmsajax
• ASP.NET Ajax Control Toolkit
Shared-source components
45. ASP.NET AJAX
• A libraries in three parts:
• MS AJAX Library
Javascript files for the browser
• ASP.NET AJAX Extensions PHP MS AJAX library on Codeplex
Server-side ASP.NET code http://codeplex.com/phpmsajax
• ASP.NET Ajax Control Toolkit
Shared-source components
46. ASP.NET AJAX
• A libraries in three parts:
• MS AJAX Library
Javascript files for the browser
• ASP.NET AJAX Extensions PHP MS AJAX library on Codeplex
Server-side ASP.NET code http://codeplex.com/phpmsajax
• ASP.NET Ajax Control Toolkit
Shared-source components
47. <?php
print “Live Demo”
?>
PHP Class encapsulation Demo using Firebug
over ASP.NET AJAX
49. Hi, haaaave you met XAML?
• Extensible Application Markup Language
• XML-based descripton language for Rich User Interfaces
• Part of the Windows Presentation Foundation (WPF)
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<TextBlock>Hello World!</TextBlock>
</Canvas>
• PHP can easily output text/xml.
50. <?php
print “Live Demo”
?>
Generate Silverlight from PHP
58. The PHP Azure SDK:
• PHP classes for Windows Azure Blobs, Tables & Queues (for CRUD
operations)
• Support for storing PHP sessions in Azure Table Storage
59. A lot is happening...
• This week
• PHP WinCache Final Release
• IIS SEO tool for Windows v1 Final Release
• ASP.NET MVC 2 beta
• ASP.NET AJAX library now in Beta
• IIS App Request Router v2 Final Release
• And more in the coming weeks...
61. The Silicon Cape Initiative...
...identified the lack of skilled software developers in the
startup-space as a major inhibitor of local innovation.
SA Developer.net and other local user groups are in a
strong position to train, enthuse and mentor the next
generation of local web startups.
If we can get passed the Microsoft vs. OpenSource
mentality and focus on code, we can do some seriously
awesome things in this city.
Develophpers You rock
62. Tim Keller
Lead PHP Developer
Umoya Networks
t/
@timkeller
e/ tim@umoya.net
Interwebs
timk.co.za
umoya.net
mystaffroom.net
Thanks for your time THE END