Your SlideShare is downloading. ×
An Oxymoron’s guide to PHP on Windows
Tim Keller
Lead PHP Developer
Umoya Networks

t/
 @timkeller
e/	 tim@umoya.net
An Oxymoron’s guide to PHP on Windows
Tim Keller
Lead PHP Developer
Umoya Networks

t/
 @timkeller
e/	 tim@umoya.net
www.umoya.net




          Hi, I’m Tim Keller   I do PHP for a living
Oxymoron. Thanks Wikipedia.

 An oxymoron (plural oxymora (greek plural) or, more often, oxymorons)
 ("sharply dull" in Gr...
The plan

• Quick intro

• History of the oxymoron

• Setting PHP on Windows

• Microsoft Web Platform Installer

• Using ...
A brief history   Once upon a time...
PHP:
Personal Home Page

by Rasmus Lerdorf in
1994
PHP:
Personal Home Page

by Rasmus Lerdorf in
1994

Wanted to get his CV
online, and see how
many users viewed it.

So he ...
PHP 2
Perl-like!

by Rasmus Lerdorf in
1995
PHP 2
Perl-like!

by Rasmus Lerdorf in
1995

Perl-ish syntax

Form handling

Embed HTML
PHP 3:
Zeev Suraski and
Andi Gutmans get
involved.
PHP 3:
Zeev Suraski and
Andi Gutmans get
involved.
PHP - a reverse initialism
PHP: Hypertext Preprocessor

Founded Zend Te...
Why PHP matters

• Web Applications   • Commercial entities
  • Wordpress          • Yahoo!
  • Drupal             • Flick...
HARD TO IGNORE.
Timeline

• Since the dawn of time
  PHP on Windows IIS is miserably bad.
Running PHP on Windows (using IIS)
Running PHP on Windows (using IIS)
Running PHP on Windows (using IIS)


 CGI
Running PHP on Windows (using IIS)


 CGI
 Invokes a new
 php.exe process for
 each request

 Advantage
 • Very stable

 D...
Running PHP on Windows (using IIS)


 CGI
 Invokes a new
 php.exe process for
 each request

 Advantage
 • Very stable

 D...
Running PHP on Windows (using IIS)


 CGI                     ISAPI
 Invokes a new
 php.exe process for
 each request

 Ad...
Running PHP on Windows (using IIS)


 CGI                     ISAPI
 Invokes a new           PHP Loaded as an
 php.exe pro...
Running PHP on Windows (using IIS)


 CGI                     ISAPI
 Invokes a new           PHP Loaded as an
 php.exe pro...
Timeline

• Since the dawn of time
  PHP on Windows IIS is miserably bad.


• 2006
  Zend and Microsoft announce collabora...
Running PHP on Windows (using IIS)


 CGI                     ISAPI
 Invokes a new           PHP Loaded as an
 php.exe pro...
Running PHP on Windows (using IIS)


 CGI                     ISAPI                  FastCGI
 Invokes a new           PHP ...
How FastCGI makes PHP on IIS awesome


                              FastCGI
                              Process caching...
How FastCGI makes PHP on IIS awesome

                       IIS 7.x Worker Process


  Request
             Read
        ...
Tuning FastCGI

• Loads of runtime parameters.


• Maximum FastCGI instances

 C:WindowsSystem32inetsrvconfigapplicationHos...
Timeline

• 2008
  MS release IIS7 with native FastCGI for PHP.
  FastCGI extensions for IIS6 released.

 Microsoft’s Pier...
The “PHP on Windows” era




                             IIS7


                      IIS6
             IIS5
<?php
print “Live Demo”
?>




                 1. Manually
Setting up PHP   2. Web Platform Installer
<?php
 print “Live Demo”
 ?>


  PHP4   PHP5.2   PHP5.3     PHP6.0




Multiple Versions      The holy grail, apparently.
Microsoft Web Platform Installer
              • Simple, yet powerful installer for:


                 • PHP and ASP.NET ...
<?php
  print “Live Demo”
  ?>




Quick look at WPI   microsoft.com/web
&




ASP.NET AJAX   and PHP
What is AJAX?

• Asynchronous Javascript and XML (or JSON, HTML, text...)
• Sometimes: Dynamic HTML, Partial Page updates,...
ASP.NET AJAX

• A libraries in three parts:

   • MS AJAX Library
     Javascript files for the browser

   • ASP.NET AJAX ...
ASP.NET AJAX

• A libraries in three parts:

   • MS AJAX Library
     Javascript files for the browser

   • ASP.NET AJAX ...
ASP.NET AJAX

• A libraries in three parts:

   • MS AJAX Library
     Javascript files for the browser

   • ASP.NET AJAX ...
ASP.NET AJAX

• A libraries in three parts:

   • MS AJAX Library
     Javascript files for the browser

   • ASP.NET AJAX ...
<?php
         print “Live Demo”
         ?>




PHP Class encapsulation   Demo using Firebug
    over ASP.NET AJAX
Microsoft Silverlight   and PHP
Hi, haaaave you met XAML?

• Extensible Application Markup Language

• XML-based descripton language for Rich User Interfa...
<?php
     print “Live Demo”
     ?>




Generate Silverlight   from PHP
WinCache   for PHP
WinCache what?

• Windows Cache Extension for PHP

  • PHP accelerator (like Zend Optimizer or APC)

  • Speeds up PHP app...
PHP + WinCache vs Zend Server + Zend Optimiser
<?php
       print “Live Demo”
       ?>




WinCache’d Wordpress   More bang for your cache
CREATE APPS WITH
            .NET,
          PHP, & Java




and PHP
Azure
PHP talking to Azure
The PHP Azure SDK:

• PHP classes for Windows Azure Blobs, Tables & Queues (for CRUD
  operations)


• Support for storing...
A lot is happening...

• This week

  • PHP WinCache Final Release

  • IIS SEO tool for Windows v1 Final Release

  • ASP...
Links

• IIS

   • http://php.iis.net

• PHP

   • Download: http://windows.php.net

• ASP.NET AJAX

   • http://phpmsajax...
The Silicon Cape Initiative...

...identified the lack of skilled software developers in the
startup-space as a major inhib...
Tim Keller
Lead PHP Developer
Umoya Networks

t/
 @timkeller
e/	 tim@umoya.net

Interwebs
timk.co.za
umoya.net
mystaffroom...
An Oxymoron's Guide to PHP on Windows
An Oxymoron's Guide to PHP on Windows
An Oxymoron's Guide to PHP on Windows
An Oxymoron's Guide to PHP on Windows
An Oxymoron's Guide to PHP on Windows
Upcoming SlideShare
Loading in...5
×

An Oxymoron's Guide to PHP on Windows

4,477

Published on

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.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,477
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • Transcript of "An Oxymoron's Guide to PHP on Windows"

    1. 1. An Oxymoron’s guide to PHP on Windows Tim Keller Lead PHP Developer Umoya Networks t/ @timkeller e/ tim@umoya.net
    2. 2. An Oxymoron’s guide to PHP on Windows Tim Keller Lead PHP Developer Umoya Networks t/ @timkeller e/ tim@umoya.net
    3. 3. www.umoya.net Hi, I’m Tim Keller I do PHP for a living
    4. 4. 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.
    5. 5. 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
    6. 6. A brief history Once upon a time...
    7. 7. PHP: Personal Home Page by Rasmus Lerdorf in 1994
    8. 8. 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.
    9. 9. PHP 2 Perl-like! by Rasmus Lerdorf in 1995
    10. 10. PHP 2 Perl-like! by Rasmus Lerdorf in 1995 Perl-ish syntax Form handling Embed HTML
    11. 11. PHP 3: Zeev Suraski and Andi Gutmans get involved.
    12. 12. 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”
    13. 13. Why PHP matters • Web Applications • Commercial entities • Wordpress • Yahoo! • Drupal • Flickr • Joomla • Digg • phpBB • Facebook • MediaWiki • YouTube • SugarCRM • Wikipedia • Gallery2 • myYearBook
    14. 14. HARD TO IGNORE.
    15. 15. Timeline • Since the dawn of time PHP on Windows IIS is miserably bad.
    16. 16. Running PHP on Windows (using IIS)
    17. 17. Running PHP on Windows (using IIS)
    18. 18. Running PHP on Windows (using IIS) CGI
    19. 19. 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
    20. 20. 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
    21. 21. 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
    22. 22. 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
    23. 23. 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
    24. 24. 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.
    25. 25. 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
    26. 26. 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
    27. 27. 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
    28. 28. 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
    29. 29. Tuning FastCGI • Loads of runtime parameters. • Maximum FastCGI instances C:WindowsSystem32inetsrvconfigapplicationHost.config <fastCgi> <application fullPath="C:PHPphp-cgi.exe" maxInstances="32"> </application> </fastCgi>
    30. 30. 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
    31. 31. The “PHP on Windows” era IIS7 IIS6 IIS5
    32. 32. <?php print “Live Demo” ?> 1. Manually Setting up PHP 2. Web Platform Installer
    33. 33. <?php print “Live Demo” ?> PHP4 PHP5.2 PHP5.3 PHP6.0 Multiple Versions The holy grail, apparently.
    34. 34. 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
    35. 35. <?php print “Live Demo” ?> Quick look at WPI microsoft.com/web
    36. 36. & ASP.NET AJAX and PHP
    37. 37. 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
    38. 38. 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
    39. 39. 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
    40. 40. 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
    41. 41. 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
    42. 42. <?php print “Live Demo” ?> PHP Class encapsulation Demo using Firebug over ASP.NET AJAX
    43. 43. Microsoft Silverlight and PHP
    44. 44. 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.
    45. 45. <?php print “Live Demo” ?> Generate Silverlight from PHP
    46. 46. WinCache for PHP
    47. 47. WinCache what? • Windows Cache Extension for PHP • PHP accelerator (like Zend Optimizer or APC) • Speeds up PHP applications running on Windows without any code modifications. • OpenSource (http://www.php.net/wincache) • Caches Relative ByteCode File Cache File Path Cache Cache
    48. 48. PHP + WinCache vs Zend Server + Zend Optimiser
    49. 49. <?php print “Live Demo” ?> WinCache’d Wordpress More bang for your cache
    50. 50. CREATE APPS WITH .NET, PHP, & Java and PHP
    51. 51. Azure
    52. 52. PHP talking to Azure
    53. 53. The PHP Azure SDK: • PHP classes for Windows Azure Blobs, Tables & Queues (for CRUD operations) • Support for storing PHP sessions in Azure Table Storage
    54. 54. 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...
    55. 55. Links • IIS • http://php.iis.net • PHP • Download: http://windows.php.net • ASP.NET AJAX • http://phpmsajax.codeplex.com • http://ajax.asp.net • PHP Azure • http://phpazure.codeplex.com
    56. 56. 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
    57. 57. 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

    ×