Windows Server Fast CGI technologies for PHP Tim

  • Slides: 55
Download presentation

Windows Server & Fast. CGI technologies for PHP Tim Keller Lead Developer Umoya Networks

Windows Server & Fast. CGI technologies for PHP Tim Keller Lead Developer Umoya Networks · www. umoya. net DTL 318

PHP GATECRASHES A MICROSOFT EVENT

PHP GATECRASHES A MICROSOFT EVENT

PHP at a Microsoft event What on earth? A Microsoft Primer for PHP developers

PHP at a Microsoft event What on earth? A Microsoft Primer for PHP developers A PHP Primer for Microsoft developers Either way, welcome! Thanks for coming.

Who am I HI, I’M TIM KELLER Tim Keller (@timkeller or timk. co. za)

Who am I HI, I’M TIM KELLER Tim Keller (@timkeller or timk. co. za) LEAD PHP DEVELOPER Your typical Mac/Linux type www. mystaffroom. net tim@mystaffroom. net Lead Developer of a PHP-based cloud hosted tool for teachers and school admins, called staffroom Microsoft-friendly

Goals Good intensions Show you some cool stuff Tell you where you can get

Goals Good intensions Show you some cool stuff Tell you where you can get it Tell you where you can learn more Answer questions Go have a beer with all of you

Stuff we’ll talk about 6 things. Simple. Microsoft and Opensource PHP and IIS Powershell

Stuff we’ll talk about 6 things. Simple. Microsoft and Opensource PHP and IIS Powershell for IIS SQL Server Driver for PHP Microsoft Ajax Library Silverlight and PHP

TAG TWEETS WITH #techedafrica FOLLOW ME twitter. com/timkeller

TAG TWEETS WITH #techedafrica FOLLOW ME twitter. com/timkeller

Microsoft and Open. Source

Microsoft and Open. Source

D ENIA L It’s not just a river in Egypt.

D ENIA L It’s not just a river in Egypt.

Microsoft and Open. Source Surprising perhaps MS Redmond OSS lab Staffed by OSS and

Microsoft and Open. Source Surprising perhaps MS Redmond OSS lab Staffed by OSS and Linux experts 300 servers of varying types 340+ Linux distros available for testing Tests interoperability of OSS and Windows Research of OSS technologies

Microsoft and Open. Source Surprising perhaps Projects so far… Firefox Silverlight support Silverlight/Moonlight common

Microsoft and Open. Source Surprising perhaps Projects so far… Firefox Silverlight support Silverlight/Moonlight common standard Vista Firefox compatibility Fast. CGI hosting of PHP and Python on IIS SQL Server drivers for PHP and Java

Microsoft and Open. Source Surprising perhaps Active and Future projects PHP Active Directory integration

Microsoft and Open. Source Surprising perhaps Active and Future projects PHP Active Directory integration PHP Share. Point integration Sugar. CRM SQL Server connectivity Windows - Apache build support/research

Why PHP anyway?

Why PHP anyway?

PHP Web Applications Wordpress php. BB Media. Wiki Drupal Gallery Sugar. CRM Doku. Wiki

PHP Web Applications Wordpress php. BB Media. Wiki Drupal Gallery Sugar. CRM Doku. Wiki Silver. Stripe CMS Joomla

PHP Web Frameworks Cake. PHP Code. Igniter Drupal e. Z Components Kohana PEAR Zend

PHP Web Frameworks Cake. PHP Code. Igniter Drupal e. Z Components Kohana PEAR Zend Framework Zoop Horde

Commercial sites using PHP Yahoo Flickr Facebook Digg You. Tube Wikipedia

Commercial sites using PHP Yahoo Flickr Facebook Digg You. Tube Wikipedia

5 -year search comparison of PHP and ASP(. net) php asp Jan 4 Jun

5 -year search comparison of PHP and ASP(. net) php asp Jan 4 Jun 20 Dec 5 May 22 Nov 6 Apr 23 Oct 8 Mar 25 Sep 9 Feb 24 Aug 10 Jan 25 2004 2005 2006 2007 2008 2009

HARD TO IGNORE.

HARD TO IGNORE.

PHP on Windows, with IIS

PHP on Windows, with IIS

PHP on Windows It’s actually been around for a long time Most PHP developers:

PHP on Windows It’s actually been around for a long time Most PHP developers: Develop on Windows Deploy to Linux, BSD, *nix. Perception that PHP on IIS sucks (this was true) Often install Apache for Dev or Production

PHP Loaded as an extension in IIS’s memory space Advantages • Very stable •

PHP Loaded as an extension in IIS’s memory space Advantages • Very stable • Better performance Disadvantages • SLOOOW due to I/O overhead of Process Creation on Windows • Not very stable • Many PHP (PECL) extensions are not Thread-Safe Fast. CGI Invokes a new php. exe process for each request ISAPI CGI Performance vs. Reliability Process caching and pooling mechanism Advantages • Faster than CGI • More Stable than ISAPI • Can run non-threadsafe versions of PHP and PECL extensions

Fast. CGI: Pooling and Caching PHP PHP HTTP Request index. php HTTP Request login.

Fast. CGI: Pooling and Caching PHP PHP HTTP Request index. php HTTP Request login. php Fast. CGI process pool for PHP 5 PHP processes are reused. No process creation overhead = 20 x performance increase HTTP Request header. php

IIS 7+ Fast. CGI Handler Basic Architecture Fast. CGI process pool for PHP 5

IIS 7+ Fast. CGI Handler Basic Architecture Fast. CGI process pool for PHP 5 IIS Worker Process Read Configuration Authenticate Fast. CGI protocol over named pipes or TCP php-cgi. exe Static Authorize Map Request Handle Request ASP. NET Fast. CGI process pool for PHP 4 Fast. CGI handler Send Response Log Request queue php. exe

C OMMUNIT Y You’d be surprised what you can accomplish when you work with

C OMMUNIT Y You’d be surprised what you can accomplish when you work with people who have common goals and ideals.

2006 Zend and Microsoft announce collaboration 2007 Zend and PHP Core Devs start optimising

2006 Zend and Microsoft announce collaboration 2007 Zend and PHP Core Devs start optimising PHP 5. 2. x builds for windows. Fast. CGI extensions for IIS 6. 2008 MS release IIS 7 with native Fast. CGI for PHP.

2008 Microsoft’s Pierre Joye and the PHP community conduct major work on the PHP

2008 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 PHP with VC++ 9 (VS 2008) x 86 and x 64 builds for Windows

2009 Microsoft release IIS 7. 5 builds with Windows 7 and Server 2008 R

2009 Microsoft release IIS 7. 5 builds with Windows 7 and Server 2008 R 2 builds. Zend ships Zend Core for Windows with Microsoft’s Fast. CGI implementation

Popular Web Servers (June ‘ 09) IIS 7 IIS 5 IIS 6 Courtesy: Netcraft

Popular Web Servers (June ‘ 09) IIS 7 IIS 5 IIS 6 Courtesy: Netcraft Web Server Survey, June 2009.

Where to get all this PHP and Fast. CGI goodness IIS 6 (Windows Server

Where to get all this PHP and Fast. CGI goodness IIS 6 (Windows Server 2003) http: //www. iis. net/php IIS 7 (Windows Vista SP 1 and Server 2008) Ships with the product. Activate the CGI feature through Server Manager IIS 7. 5 (Windows 7 and Server 2008 R 2) Supports Failed Request Tracing for Fast. CGI (PHP)

demo Setting up PHP on Windows & IIS Tim Keller Lead Developer Umoya Networks

demo Setting up PHP on Windows & IIS Tim Keller Lead Developer Umoya Networks

IIS 7 features Modular architecture for reduced attack surface Advanced Diagnostics XML-based configuration system

IIS 7 features Modular architecture for reduced attack surface Advanced Diagnostics XML-based configuration system Remote Management capability Integration with Windows Media Server Ability to extend IIS 7 using managed code

M I S S I O NI M P O S S I B

M I S S I O NI M P O S S I B L E Wait…what?

PHP Developers want: Multiple versions of PHP on one server. PHP 4 PHP 5.

PHP Developers want: Multiple versions of PHP on one server. PHP 4 PHP 5. 2 PHP 5. 3 PHP 6. 0

URL Rewriting Ever used mod_rewrite in Apache? http: //timk. co. za/index. php? type=post&id=34 becomes

URL Rewriting Ever used mod_rewrite in Apache? http: //timk. co. za/index. php? type=post&id=34 becomes http: //timk. co. za/post/34 IIS 7 offers this, without the need for complex Regular Expressions

demo More PHP'ing Tim Keller Lead Developer Umoya Networks

demo More PHP'ing Tim Keller Lead Developer Umoya Networks

Power. Shell and IIS Powerful command line for Windows With IIS 7. 5 you

Power. Shell and IIS Powerful command line for Windows With IIS 7. 5 you can manipulate your IIS config from the command line.

SQL Server and PHP An INNER JOIN made in heaven? Simple Goal To provide

SQL Server and PHP An INNER JOIN made in heaven? Simple Goal To provide robust, scalable, and reliable SQL Server connectivity to PHP developers targeting the Windows platform. Built by Microsoft with community feedback Version 1. 0 released July 2008 http: //blogs. msdn. com/sqlphp/ (good blog)

ASP. NET AJAX and PHP Take back the web, sorta.

ASP. NET AJAX and PHP Take back the web, sorta.

What is AJAX? Traditional Client/Server AJAX Paradigm User Interface Request Response Web Server Ajax

What is AJAX? Traditional Client/Server AJAX Paradigm User Interface Request Response Web Server Ajax Engine Web Server

What AJAX (sometimes) means DHTML: HTML + Javascript Animations Drag and Drop Show and

What AJAX (sometimes) means DHTML: HTML + Javascript Animations Drag and Drop Show and Hide Partial page updates User interface makes background calls to server AJA* : XML, HTML, Text, JSON…

ASP. NET AJAX A library in three parts MS Ajax Library Javascript files for

ASP. NET AJAX A library in three parts MS Ajax Library Javascript files for the frontend ASP. Net Ajax Extensions Server-side. NET code ASP. Net Ajax Control Toolkit Shared-source components The PHP MS AJAX library was released in 2008. http: //codeplex. com/phpmsajax

demo ASP. NET AJAX with PHP Tim Keller Lead Developer Umoya Networks

demo ASP. NET AJAX with PHP Tim Keller Lead Developer Umoya Networks

Silverlight from PHP

Silverlight from PHP

Hi, haaaave you met XAML? XML-based description of a Rich User Interface. Part of

Hi, haaaave you met XAML? XML-based description of a Rich User Interface. Part of the Windows Presentation Foundation. <Canvas xmlns="http: //schemas. microsoft. com/winfx/2006/xaml/presentation"> <Text. Block>Hello World!</Text. Block> </Canvas> PHP can easily output text/xml. XAML also supports UI Events. Which is cool.

demo Silverlight from PHP Tim Keller Lead Developer Umoya Networks

demo Silverlight from PHP Tim Keller Lead Developer Umoya Networks

Futures for PHP on Windows IE Web. Slices from PHP applications PHP MS Virtual

Futures for PHP on Windows IE Web. Slices from PHP applications PHP MS Virtual Earth Integration On-going SQL Server driver development Azure PHP SDK

Call to action We want you! Enable Fast. CGI in IIS 7 Install PHP

Call to action We want you! Enable Fast. CGI in IIS 7 Install PHP Grab some cool PHP apps Tell your friends how great PHP is on IIS. Tweet about it!

Session Resources Web Platform Installer http: //tinyurl. com/mswebplatform URL Rewrite in IIS 7 http:

Session Resources Web Platform Installer http: //tinyurl. com/mswebplatform URL Rewrite in IIS 7 http: //www. iis. net/extensions/URLRewrite PHP on Windows central http: //www. iis. net/php PHP builds and sourcecode for Windows http: //windows. php. net Microsoft AJAX for PHP www. codeplex. com/phpmsajax Silverlight www. silverlight. net

question & answer

question & answer

Resources Tech·Ed Africa 2009 sessions will be made available for download the week after

Resources Tech·Ed Africa 2009 sessions will be made available for download the week after the event from: www. tech-ed. co. za www. microsoft. com/teched www. microsoft. com/learning International Content & Community Microsoft Certification & Training Resources http: //microsoft. com/technet http: //microsoft. com/msdn Resources for IT Professionals Resources for Developers

Related Content Breakout Sessions (session codes and titles) Whiteboard Sessions (session codes and titles)

Related Content Breakout Sessions (session codes and titles) Whiteboard Sessions (session codes and titles) Hands-on Labs (session codes and titles)

Track Resources Resource 1 Resource 2 Resource 3 Resource 4

Track Resources Resource 1 Resource 2 Resource 3 Resource 4

10 pairs of MP 3 sunglasses to be won Complete a session evaluation and

10 pairs of MP 3 sunglasses to be won Complete a session evaluation and enter to win!

© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows Vista and other product names

© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U. S. and/or other countries. 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.