Windows Server and Fast CGI Technologies For PHP


Published on

PHP is a wildly popular scripting language for the web, and powers some of the largest websites on the Internet. Traditionally, PHP on Windows has been something of an oxymoron.

Join us and find out why PHP is now highly performant, scalable and efficient when run under FastCGI on Windows Server and IIS. Presented by a local PHP developer, you'll gain insight into how you can take advantage of PHP on Windows, and integrate it with technologies like PowerShell, ASP.NET and SQLServer.

Originally presented at Microsoft TechEd Africa 2009 (August 3, 2009)

Published in: Technology
1 Comment
1 Like
No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Met a couple of speakers in the lift last night… said I was doing the PHP talk… yeah…
  • Q: Why are you here?
  • For the longest time, Microsoft ignored OpenSource
  • But that’s changed
  • PHP Community develop on Windows (Zend Studio, etc) but DEPLOY to LinuxWindows = Performance vs. Reliability issueWindows: Heavy to start a process, light to start a threadLinux: Light to start a process, heavy to start a process
  • Multiple versionsWordpressURLRewriting
  • Multiple versionsWordpressURLRewriting
  • Windows Server and Fast CGI Technologies For PHP

    1. 1.
    2. 2.
    3. 3. Windows Server & FastCGI technologies for PHP<br />Tim Keller<br />Lead Developer<br />Umoya Networks ·<br />DTL318<br />
    5. 5. PHP at a Microsoft eventWhat on earth?<br />A Microsoft Primer for PHP developers<br />A PHPPrimer for Microsoftdevelopers(more likely, since this is TechEd)<br />Either way, welcome! Thanks for coming.<br />
    6. 6. Who am ITim Keller (@timkelleror<br />Your typical Mac/Linux type<br />Lead Developer of a PHP-based cloud hosted tool for teachers and school admins, called staffroom<br />Microsoft-friendly<br />HI, I’M TIM KELLER<br />LEAD PHP DEVELOPER<br /><br /><br />
    7. 7. GoalsGood intensions<br />Show you some cool stuff<br />Tell you where you can get it<br />Tell you where you can learn more<br />Answer questions<br />Go have a beer with all of you<br />
    8. 8. Stuff we’ll talk about6 things. Simple.<br />Microsoft and Opensource<br />PHP and IIS<br />Powershell for IIS<br />SQL Server Driver for PHP<br />Microsoft Ajax Library<br />Silverlight and PHP<br />
    9. 9. TAG TWEETS WITH<br />#techedsa2009<br />FOLLOW ME<br /><br />
    10. 10. Microsoft and OpenSource<br />
    11. 11. DeniaL<br />It’s not just a river in Egypt.<br />
    12. 12. Microsoft and OpenSourceSurprising perhaps<br />MS Redmond OSS lab<br />Staffed by OSS and Linux experts<br />300 servers of varying types<br />340+ Linux distros available for testing<br />Tests interoperability of OSS and Windows<br />Research of OSS technologies<br />
    13. 13. Microsoft and OpenSourceSurprising perhaps<br />Projects so far…<br />Firefox Silverlight support<br />Silverlight/Moonlight common standard<br />Vista Firefox compatibility<br />FastCGI hosting of PHP and Python on IIS<br />SQL Server drivers for PHP and Java<br />
    14. 14. Microsoft and OpenSourceSurprising perhaps<br />Active and Future projects<br />PHP Active Directory integration<br />PHP SharePoint integration<br />SugarCRM SQL Server connectivity<br />Windows - Apache build support/research<br />
    15. 15. Why PHP anyway?<br />
    16. 16. BraverY<br />Wounds Heal. Chicks dig scars. Glory lasts forever.<br />
    17. 17. PHP Web Applications<br />
    18. 18. PHP Web Frameworks<br />
    19. 19. Commercial sites using PHP<br />
    20. 20.
    21. 21. HARD TO IGNORE.<br />
    22. 22.
    23. 23. PHP on Windows, with IIS<br />
    24. 24. PHP on WindowsIt’s actually been around for a long time<br />Most PHP developers:<br />Develop on Windows<br />Deploy to Linux, BSD, *nix.<br />Perception that PHP on IIS sucks (this was true)<br />Often install Apache for Dev or Production<br />
    25. 25. Performance vs. Reliability<br />
    26. 26. FastCGI: Pooling and Caching<br />HTTP Request<br />index.php<br />PHP<br />PHP<br />HTTP Request<br />login.php<br />PHP<br />PHP<br />FastCGI process pool for PHP5<br />PHP processes are reused.<br />No process creation overhead = 20x performance increase<br />HTTP Request<br />header.php<br />
    27. 27. IIS7+ FastCGI HandlerBasic Architecture<br />FastCGI process pool for PHP5<br />IIS Worker Process<br />FastCGI protocol over named pipes or TCP<br />php-cgi.exe<br />FastCGI process pool for PHP4<br />Request queue<br />php.exe<br />
    28. 28. CommunitY<br />You’d be surprised what you can accomplish when you work with people who have common goals and ideals.<br />
    29. 29. 2006Zend and Microsoft announce collaboration<br />2007Zend and PHP Core Devs start optimising PHP5.2.x builds for windows. FastCGI extensions for IIS6.<br />2008MS release IIS7 with native FastCGI for PHP.<br />
    30. 30. 2008Microsoft’s Pierre Joye and the PHP community conduct major work on the PHP 5.3 codebase.<br />Fixed 60+ Windows-specific bugs<br />Updated every library to latest version (some were 10+ years old)<br />Compiled PHP with VC++ 9 (VS 2008)<br />x86 and x64 builds for Windows<br />
    31. 31. 2009<br />Microsoft release IIS 7.5 builds with Windows 7 and Server 2008 R2 builds.<br />Zend ships Zend Core for Windows with Microsoft’s FastCGI implementation<br />
    32. 32. Popular Web Servers (June ‘09)<br />IIS7<br />IIS6<br />IIS5<br />Courtesy:Netcraft Web Server Survey, June 2009.<br />
    33. 33. Where to get all thisPHP and FastCGI goodness<br />IIS 6 (Windows Server 2003)<br /><br />IIS 7 (Windows Vista SP1 and Server 2008)<br />Ships with the product.<br />Activate the CGI feature through Server Manager<br />IIS 7.5 (Windows 7 and Server 2008R2)<br />Supports Failed Request Tracing for FastCGI (PHP)<br />
    34. 34. Setting up PHP on Windows & IIS<br />Tim Keller<br />Lead Developer<br />Umoya Networks<br />demo<br />
    35. 35. Mission impossiblE<br />Wait…what?<br />
    36. 36. PHP Developers want:<br />Multiple versions of PHP on one server.<br />
    37. 37. Real-world PHP<br />Tim Keller<br />Lead Developer<br />Umoya Networks<br />demo<br />
    38. 38. URL Rewriting<br />Ever used mod_rewrite in Apache?<br /><br />IIS7 offers this, without the need for complex Regular Expressions<br />
    39. 39. URL Rewrite<br />Tim Keller<br />Lead Developer<br />Umoya Networks<br />demo<br />
    40. 40. PowerShell and IIS<br />Powerful command line for Windows<br />With IIS7.5 you can manipulate your IIS config using PowerShell<br />Create websites<br />Manage Security<br />Configure FastCGI<br />Much more<br />
    41. 41. SQL Server and PHPAn INNER JOIN made in heaven?<br />Simple Goal<br />To provide robust, scalable, and reliable SQL Server connectivity to PHP developers targeting the Windows platform.<br />Built by Microsoft with community feedback<br />Version 1.0 released July 2008<br /><br />Microsoft working with SugarCRM (PHP app)<br />
    42. 42. ASP.NET AJAX and PHP<br />Take back the web, sorta.<br />
    43. 43. What is AJAX?<br />Traditional Client/Server<br />AJAX Paradigm<br />User Interface<br />User Interface<br />Ajax Engine<br />Request<br />Response<br />Web Server<br />Web Server<br />
    44. 44. What AJAX (sometimes) means<br />DHTML: HTML + Javascript<br />Animations<br />Drag and Drop<br />Show and Hide<br />Partial page updates<br />User interface makes background calls to server<br />AJA* : XML, HTML, Text, JSON…<br />
    45. 45. ASP.NET AJAX<br />A library in three parts<br />MS Ajax LibraryJavascript files for the frontend<br />ASP.Net Ajax ExtensionsServer-side .NET code<br />ASP.Net Ajax Control Toolkit Shared-source components <br />The PHP MS AJAX library was released in 2008.<br />
    46. 46. ASP.NET AJAX with PHP<br />Tim Keller<br />Lead Developer<br />Umoya Networks<br />demo<br />
    47. 47. Silverlight from PHP<br />
    48. 48. Hi, haaaave you met XAML?<br />XML-based description of a Rich User Interface.<br />Part of the Windows Presentation Foundation.<br />PHP can easily output text/xml.<br />XAML also supports UI Events. Which is cool.<br />&lt;Canvas xmlns=&quot;;&gt; &lt;TextBlock&gt;Hello World!&lt;/TextBlock&gt; <br />&lt;/Canvas&gt; <br />
    49. 49. Silverlight from PHP<br />Tim Keller<br />Lead Developer<br />Umoya Networks<br />demo<br />
    50. 50. Interoperability<br />It’s about building relationships for the common good.<br />
    51. 51. Call to actionWe want you!<br />EnableFastCGI in IIS7<br />Install PHP<br />Grab some cool PHP apps<br />Tell your friends how great PHP is on IIS.<br />Tweet about it!<br />
    52. 52. Session Resources<br />Web Platform Installer<br />URL Rewrite in IIS7<br /><br />PHP on Windows central<br /><br />PHP builds and sourcecode for Windows<br /><br />Microsoft AJAX for PHP<br /><br />Silverlight<br /> and<br />
    53. 53. question & answer<br />
    54. 54. Required Slide<br />Speakers, <br />TechEd 2009 is not producing <br />a DVD. Please announce that <br />attendees can access session <br />recordings from Tech-Ed website. These will only be available after the event.<br />Tech·Ed Africa 2009 sessions will be made available for download the week after the event from:<br /><br />International Content & Community<br /><br />Microsoft Certification & Training Resources<br /><br />Resources for IT Professionals<br /><br />Resources for Developers<br />Resources<br />
    55. 55. Related Content<br />Required Slide<br />Speakers, <br />please list the Breakout Sessions, TLC Interactive Theaters and Labs that are related to your session. Any queries, please check with your Track Owner.<br />Breakout Sessions <br />WUX301 – Microsoft Codename Velocity (Mon, 15:45, C3)<br />DTL302 – Embrace OpenSource on CodePlex(Tues, 12:00, A3)<br />WSV309 – What’s new in Server Core for Windows Server 2008 (Tues, 14:30, D5)<br />WUX302 – ASP.NET Under the covers (Tues, 17:30, C3)<br />Whiteboard Sessions<br />WTB216 – Web Development Whiteboard Discussion (Tuesday, 13:15-14:15, Room C1)<br />
    56. 56. Required Slide<br />10 pairs of MP3 sunglasses to be won<br />Complete a session evaluation and enter to win!<br />
    57. 57. Required Slide<br />© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.<br />The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.<br />