• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
An Oxymoron's Guide to PHP on Windows
 

An Oxymoron's Guide to PHP on Windows

on

  • 4,573 views

For the longest time, the utterance of "PHP" and "Windows" within the same sentence meant the speaker was either temporarily insane, or horribly misguided....

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.

Statistics

Views

Total Views
4,573
Views on SlideShare
4,536
Embed Views
37

Actions

Likes
1
Downloads
0
Comments
0

8 Embeds 37

http://timk.co.za 22
http://www.slideshare.net 4
http://school.test 3
http://www.linkedin.com 3
http://timkeller.me 2
http://timokeller.net 1
http://www.timokeller.net 1
http://tumble.timokeller.net 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

An Oxymoron's Guide to PHP on Windows An Oxymoron's Guide to PHP on Windows Presentation Transcript

  • 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 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.
  • 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
  • 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 wrote a programming language.
  • 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 Technologies and rewrote the parser which forms PHP 4 (May 2000). Released PHP 5 in 2004. PHP 6 is “in progress”
  • Why PHP matters • Web Applications • Commercial entities • Wordpress • Yahoo! • Drupal • Flickr • Joomla • Digg • phpBB • Facebook • MediaWiki • YouTube • SugarCRM • Wikipedia • Gallery2 • myYearBook
  • 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 Disadvantage • SLOW due to I/O overhead of Process Creation on Windows
  • 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
  • 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
  • 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
  • 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
  • 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.
  • 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
  • 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
  • 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
  • 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
  • Tuning FastCGI • Loads of runtime parameters. • Maximum FastCGI instances C:WindowsSystem32inetsrvconfigapplicationHost.config <fastCgi> <application fullPath="C:PHPphp-cgi.exe" maxInstances="32"> </application> </fastCgi>
  • 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
  • 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 binaries, • PHP and ASP.NET 3rd party apps. • Available at http://www.microsoft.com/web
  • <?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, Rich Internet Apps. Traditional Client/Server AJAX Paradigm User Interface User Interface Request Response Ajax Engine Web Server Web Server
  • 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
  • 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
  • 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
  • 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
  • <?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 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.
  • <?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 applications running on Windows without any code modifications. • OpenSource (http://www.php.net/wincache) • Caches Relative ByteCode File Cache File Path Cache Cache
  • 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 PHP sessions in Azure Table Storage
  • 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...
  • 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
  • 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
  • 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