Drupal Camp Toronto


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • So the prevailing notion among many in the web is that running PHP on Windows is largely not an option.Running PHP on Windows in a production environment was completely a joke.Certainly going back five years and even longer because PHP for Windows has been around for a long time. It would look like this…For many years the ability to run PHP on Windows meant terrible or unpredictable performanceOther things were missing including a good option for clean URL’s and cachingSo beginning in 2007 Microsoft set about to change that.Today I am going to talk to you about the things we’ve been doing and talking to you about how PHP on Windows is not just possible but for many of you but actually performs very well.I then want to talk about some of the work we have been doing with the Drupal community for the last two years to make Drupal even better.So let’s get started.
  • In 2007Fast CGIWith the release of FastCGI first time you could actually consider hosting php on win/iis, production quality, no more crashes.FastCGI handles PHP requests out of an app pool rather than spinning up a new one each time.FastCGI provides optimal PHP performance without having to manually tune:Fast CGI provides Automatic performance tuning.Determines: CPU usage, memory consumption, context switches. Based upon that information it changes the number of PHP processes to optimize your application automatically. (SetsDynamic Max Instances)Very important if you are managingmany customers on a single machine since it allows for a higher density of PHP applications on Windows than you could get before or a customer with an app that has large changes in requests over time.Automatic recycling of PHP processes in IIS when php.ini changes. No longer need to restart IIS.Version 1.5 now has a consistent set of features across all versions of IIS. This is important as a significant number of PHP developers still use XP. This will allow them to develop and deploy seamlessly to Windows Server. Version 1.5 of Fast-CGI is included in Windows Server 2008 R2 (IIS 7.5), an update is available for IIS 7 along with a back-port for those using XP.Another useful feature I wanted to point out here as well is you can provide to your customers developing or running PHP on Windows/IIS is the Advanced Logging module in IIS which you can use to consolidate event reporting for PHP itself as well as from IIS. This will help your customers consolidate application performance reporting, good for tracking failed requests or other issues in your php application. No need to have separate error log files for webserver and php.
  • IISIIS 7.0 is a from the ground up rewrite over the previous versions and with a new architecture. Default Min Install:The new IIS 7.0 architecture and default minimum install enables a significant reduction in attack surface making it far more secure.Modular Architecture: Previous versions of IIS were difficult to customize or streamline for high performance applications.This new modular architecture makes it far easier to create modules and handlers at any point in the processing pipeline.You also don’t have to write these modules in C++ anymore either. You can create them in managed code far faster and with excellent performance.Streamlined Processing Pipeline: The modular architecture allows for a streamlined processing pipeline. Load only what modules you need for much better performance.Web Config: The new configuration system in IIS 7.0 loads configuration files—similar to .htaccess files in Apache—and manages them in a cache after first read. All subsequent requests use the cached configuration and the new configuration cache consumes significantly less memory than the equivalent in Apache. IIS 7.0 also includes caching support for all types of dynamic content.
  • Compile and file operations on Windows are slower than on linux. Many more security checks, etc.Many PHP developers on Linux use other caching mechanisms such as memcache or APC.There are no good open source solutions for caching on Windows WinCache is our solution to help provide even more performance for PHP on Windows.Opcode cache – this is a cache of the compiled PHP file. WinCache let PHP core compile the PHP file to generate opcodes first time it is executed. Then caches these opcodes in memory and is shared with other PHP processesIncreasing performance, especially on subsequent access to the executable code. Can expect a 100%-200% increase in performance.File cache – File IO operations on Windows are much more expensive than on Linux. For files on UNC’s or NFS in hosting environments scenarios it is even worse. File Cache stores the contents of opened files in shared memory. This increases performance 80-90% over accessing the files each time from a shared location.Resolve File Path cache – On first access a PHP application will work to determine the absolute path to a file to then open itThis feature is used to store the absolute path from relative file paths used in PHP applications.Again, anything to reduce usage of the file systems calls produces performance gains.Session Cache:The session cache will take and store session data in shared memory cache instead of file system for added performance benefits.Currently this feature can only be used in a web farm where there is session affinity.User Data Cache API’s: Provides caching functions(API’s) with the Can be used by PHP applications for storing variables and objects in shared memory using WinCache instead of PHPs cache.You can cache database data, php data, classes, etc. Overall just closing the feature gap to APC, etc. trying to have a complete solution.WinCache Statistics Script – This thing is very cool and you should check it out. Great for helping you benchmark and fine tune your PHP applications on Windows. Is installed with the WinCache for PHP.PS: this file is only protected with HTTP basic authentication so if you deploy this file make sure you secure it.
  • 5.2Old Library BinariesLibraries being compiled against were up to 12 years oldSource Missing/UnknownMany libraries only existed in binary form, unknown origin and license.No Security UpdatesNearly no security updates to libraries has happened in the last decadeMissing Feature ParityWith no updates, generally features were often not implemented on Windows5.3Every Library built from SourceEvery single dependent library was built from a new build, derived from the original project.Tracking dependent projectsBoth Security and Features can be kept 100% in sync with other platforms, due to the ability to track the originating source codeWorking with the codeIt’s now possible to work with the source code of the originating project, and apply modern building techniques and optimizations.For the existing PHP for Windows 5.2 build:Unix ‘configure’-style makefilesMakefiles are generated using Unix-style configure scripts. Functionality is emulated with JScriptNo OptimizationsMakefiles are generated with no ability to optimize entire builds, nor take advantage of better tools, compilers, etc.Independent DependenciesLibraries never compiled with the same settings.Undefined processVery few people had all the right bits/tools to even compile the Windows PHP binaries—Certainly impossible to replicate an exact build.Now after working on this problem:Created a clean, unified buildUsing tools built by the OSTC, we have constructed a better build process which opens many new possibilities, yet can easily adapt to new changes by developers using older technologies.One unified set of propertiesGenerated project files use a single set of build configuration files, allowing 100% of the code to be built to the same specifications.Optimizations everywhereThe new process lets us take advantage of high-performance PGO technology to improve the performance of PHP by leaps and bounds.Optimizations for you.With the new process, we can now do instrumented builds of the entire stack, allowing us to analyze and improve PHP for any environment.CompilerFor PHP 5.2:VC 6 buildsVisual C++ 6.0, being over a decade old, would not produce code optimized for modern operating systems and hardware.Older CompilerPHP on Windows was being left behind, simply because it was nearly impossible to build with any other compiler No 64 bit supportVC 6 offered no ability to build for 64 bit WindowsFor PHP 5.3:VC 9 buildsVisual C++ 9.0 provides technologies that allow us to target today’s operating systems and hardware.New Compiler By just changing the compiler, generates code that performs better, even before using advanced PGO technologies.Now, 64 bit supportWe are now building 64bit snapshot builds alongside the 32 bit builds, 95%+ libraries are 64 bit too.POSIX:PHP 5.2Heavy use of POSIX emulationPHP has been built with POSIX in mind, and therefore, on Windows it was natural to adopt emulation libraries to accomplish similar tasks.Using wrong methods Often, the way to do something on Unix, is not the way to do it on Windows.Non-standard ImplementationsMany libraries were being used to supply functionality that was already present in Windows (Crypto, DNS, etc)Targeted oldest OS possibleWindows 98 was considered a primary target… ‘nuff said!Unix was the primary platformIf it worked on a Unix platform, it was done... Windows was never given any attention, nor care by hardly anyoneTests did not have high pass rate.The standard PHP test suite did not pass with a strong success rate.Security was a Unix concern.Security considerations for Windows were not taking place, no Windows developers were on the Security Mailing ListsNo tools for doing automated testing.Nearly no tools to assist in automation of testing on Windows at all.PHP 5.3Eliminated POSIX emulationDropped the POSIX emulation libraries, and code has been written to use Win32 APIs correctly.Choosing the Win32 WayImplemented features in a way that doesn’t mimic the method on Unix, just the results. Use native libraries/APIs Replaced that code with calls to the natively provided APIs.Targets new OS, gracefullyRecent code changes now allow us to target features on the latest versions of Windows, and provides graceful failure on down-level platforms.Windows is a primary platformWindows is now a primary platform, and changes which break Windows must be addressed.98%+ tests now pass on Windows.Over 98% of tests now pass on Windows, and we’re aiming to close the gap completely.Windows is now representedWindows developers are now on the security mailing lists, and can take action at the same time.New Testing ToolsThe OSTC has created new tools for testing FastCGI and PHP builds that can be included in the official build process, providing PGO and instrumentation data to the developers.So prior to PHP 5.3 the PHP engine itself wasn’t mature on Windows, causing compatibility and performance problems.Implemented with APR (Apache portable runtime) instead of directly on Win32 created subpar performanceAlso many Windows-specific PHP bugs hadn’t been fixedThere were as I mentioned earlier issues with hosting on IIS itself with the slow CGI or unstable ISAPI handler. Using FastCGI provided the fix for that part.The next piece was…PHP 5.3Has an updated code baseMuch of PHP for Windows completely rewritten to use native Win32 instead of through the POSIX layerAlso compiled using our latest compiler VC9 versus VC 6 which was 10 years oldUse the NTS version. No thread safety checks since PHP runs Single threaded on IIS in FastCGI.Reason for NTS is that many of the most popular community extensions themselves are NTS themselves, making NTS the default on Windows is the safest route for stability.Btw, Anybody know who this guy Rasmus guy is?All libraries updated to latest versions (in some cases newer versions that used on Linux)Re-Wrote the build system from scratchTop PHP Windows community programmer working for MicrosoftBuild with VS 2008Available in 32 and 64 bit versionCreated windows.php.net99% of all POSIX calls changed to native Windows calls
  • PHP Manager for IIS 7 is a open source extension for IIS Management Console, that greatly simplifies the tasks of setting up, configuring and managing one or more PHP versions on IIS server. Use it to register PHP with IIS, run multiple PHP versions, get the information about PHP runtime settings, add and modify php.ini directives and enable or disable PHP extensions.Features:Simple registration of many PHP versions with IISAn easy way of checking if PHP works correctly by geting the output of phpinfo() functionConfiguring the PHP error reproting settings for production or development environmentManaging all php.ini directives and PHP extensions from within IIS managerRemote PHP administration via IIS Remote Administration ToolWorks well with PHP installed via Web Platform Installer or PHP Windows Installer
  • Signed version includes support
  • Windows Azure is our Cloud Platform and is open & interoperable out of the boxSupport for Industry Web Standards (REST, oData, Atom Pub) enabling interoperabilityGreat support for PHPOpen source tooling from Eclipse & Language bindings for PHPWindows Azure companion enables seamless deployment. Currently working on enabling community apps (drupal) to be supported on Azure. Windows Azure Companion (new) (CTP) – a new tool that aims to provide a seamless experience when installing and configuring PHP platform-elements (PHP runtime, extensions) and web-applications running on Windows Azure. Windows Azure Tools for Eclipse for PHP (v2.0) – End to End Windows Azure Platform Cloud Development for PHP DevelopersWindows Azure Command Line Tools for PHP (v2.0) – a command-line tool, which offers PHP developers a simple way to package PHP based applications in order to deploy to Windows AzureWindows Azure SDK for PHP version 2.0 (v2.0) – enables PHP developers to easily extend their applications by leveraging Windows Azure services (like Blobs, tables and queues) in their web applications whether they run on Windows Azure or on another cloud platform.
  • Launched with Web App Gallery in 2009http://acquia.com/blog/microsoft-promoting-drupalAcquia DrupalAcquia was one of the very first web applications we had in the Web App Gallery.The Web PI makes installing web applications on Windows very easy.Web PI detects any missing dependencies and installs them for you, including PHP and MySQL. It also properly configures IIS for PHP and installs URL Rewrite module for Clean URL’s and WinCache for improved performance.
  • http://qa.drupal.org/pifr/statusParticipating on drupal.org forums
  • Drupal and SQL ServerOver a year ago the SQL Server team at Microsoft set about to add PDO support to our existing SQL Server Driver for PHP.We teamed up with Commerce Guys to create a SQL Server Module for Drupal using the new PDO support in Drupal 7.We first showed our work with Commerce Guys at DrupalCon SFSince then Commerce Guys have done more testing on a number of modules using SQL Server.We’ve been able to make great performance improvements to both our PDO driver as well as the SQL Server Drupal Module.And today here in a few moments Damien Tournoud is going to show off a special project using SQL Server Reporting Services that highlights some of the great functionality you get from SQL Server that you can also use in your Drupal sites.HardwareFinally Microsoft is dedicated to ensuring the best levels of interoperability and performance so we’ve made a contribution of hardware to support the testing for the contributed works that we built with Commerce Guys.So at this point we’ll say it’s early. We’re just getting started but we wanted to highlight some of the things we’ve been working on with some in the Drupal community and we are really looking for other ways in which we can help make Drupal even better.
  • Project DaNGOMicrosoft was a sponsor this project started by the Drupal community to create a Drupal distribution specifically for NGO’s.The project resulted in a number of contributed modules that you can use in your Drupal sites today including Windows Messenger moduleBing Geocode module to map addressesAn eNewsletter module that built before hand and included as part of DaNGOA fundraising moduleAnd an Activity Dashboard to expose data to build your own data dashboard.
  • Drupal Camp Toronto

    1. 1. Drupal & Microsoft<br />Mark Brown<br />Web Platform Team<br />mark.brown@microsoft.com<br />@markjbrown<br />d.o: markjbrown<br />/Web<br />
    2. 2. Abstract<br />For a number of years it was well known that running PHP or Drupal on Windows and IIS was largely not possible, especially in a production hosted environment. What is largely not known is today how much that has changed. For the last 5 years Microsoft has been working very closely with the PHP community and there are a number of recent changes to our web platform of Windows Server, IIS and SQL Server that make running PHP on the Microsoft Web Platform a reality for production sites. And over the last two years Microsoft has been working with the Drupal community to make Drupal run great on our platform as well.<br />This is that story…<br />
    3. 3. But first….<br />Let’s talk about PHP<br />on Windows…<br />
    4. 4. A look back to 2006<br />PHP 4.4, 5.0 <br />IIS 6<br />PHP on Windows+IIS<br />Running on CGI<br />Stable but Slow<br />Running on ISAPI<br />Fast but unstable<br />
    5. 5. FAST-CGI PHP<br />Production PHP on Windows!!!<br />Requests from app pool<br />Automatic max app pool sizing<br />Auto recycling PHP pool when php.ini changes<br />Consolidate PHP errors in IIS<br />
    6. 6. IIS 7<br />Nearly ground up Rewrite<br />New modular architecture<br />Default minimum installation<br />Streamlined processing pipeline<br />New XML-based web.config<br />
    7. 7. URL REWRITE<br />Required for many Web CMS’s<br />Rules-based, text file or database<br />Reg-Ex & wildcard matching<br />Rewrite:<br />Outbound URL’s<br />Request headers and Server variables<br />HTTP Response<br />Inside specific html tags in response<br />Import Apache mod_rewrite<br />
    8. 8. WINCACHE<br />PHP Cache for Windows<br />OpcodeCache<br />File Cache<br />Resolve File Path Cache<br />Session Cache <br />User Data Cache<br />WinCache Statistics Script<br />Open source on PECL<br />
    9. 9. PHP 5.3<br />Total rebuild from source<br />Feature & security parity<br />Rewrote the build system<br />Native Win32 instead of POSIX<br />Latest compiler VC9<br />Many other optimizations<br /> Use NTS version for IIS<br />
    10. 10. PHP Manager<br />Register multiple PHP versions<br />Easy checking of phpinfo()<br />Configure error reporting<br />Manage php.ini directives<br />Manage all PHP extensions<br />Remote PHP administration<br />
    11. 11. SQL Server<br />PHP Driver for SQL Server 2.0<br />Support for native PHP<br />Support for PDO<br />Support for PHP 5.3<br />Source released under Apache 2.0<br />Drupal 7 will be first major PHP app with SQL Server support<br />
    12. 12. IIS databaseManager<br />Consolidate MySQL or SQL Server Management inside IIS where you manage your sites<br />Manage local/remote databases<br />Create and edit tables<br />Add and edit data<br />Modify indexes and keys<br />Create and execute queries<br />
    13. 13. PHP Interoperability<br />Windows Azure Companion (CTP)<br />Install & configure PHP & web apps <br />Azure Tools for Eclipse/PHP<br />Build for the cloud on PHP<br />Azure CmdLine Tools for PHP<br />Cmd line package & deploy to Azure<br />Windows Azure SDK for PHP <br />Extend with blobs, tables and queues<br />Currently working on getting Drupal to work great on Windows Azure<br />
    14. 14. Drupal & MICROSOFT<br />Web App Gallery<br />Easiest way to install<br />Zip + Manifest<br />Packages built and tested for Windows+IIS<br />Detects/Installs dependencies<br />
    15. 15. Drupal & MICROSOFT<br />Drupal QA Team<br />Certify for Drupal<br />Windows<br />IIS<br />MySQL<br />Participating on drupal.org forums <br />
    16. 16. Drupal& MICROSOFT<br />Drupal 7 will ship with web.config<br />Drupal 7 with MSSQL<br />SQL_PDO Driver<br />Drupal Module for SQL<br />Now available!!!<br />
    17. 17. Drupal & MICROSOFT<br />DaNGO<br />Drupal and NGO’s<br />Windows Messenger<br />Bing Geocode<br />Activity Dashboard<br />Fundraising<br />eNewsletter*<br />Install Profile<br />
    18. 18. Microsoft WebMatrix<br />Introducing…<br />What Else?<br />
    19. 19. Drupal & WEBMATRIX<br />Create a new Drupal site<br />Web Application Gallery<br />Acquia Drupal 6<br />Drupal 7 <br />Create from Folder<br />Drupal install profile<br />
    20. 20. Drupal & WEBMATRIX<br />Customize and Test<br />Light-weight editor<br />HTML, PHP, CSS<br />Easily add modules<br />MySQL Database editor <br />Monitor HTTP Requests<br />Tune and optimize for Search Engines<br />
    21. 21. Drupal & WEBMATRIX<br />Publish to the Web<br />FTP<br />Web Deploy<br />Includes Database<br />Pull - Synchronize<br />Web Hosting Gallery<br />Great deals on hosting<br />Drupal on Windows + IIS <br />PHP and MySQL<br />
    22. 22. Learn More…<br />PHP on Windows<br />microsoft.com/web/php<br />Web Matrix Download<br />microsoft.com/web/webmatrix<br />Drupal on Windows<br />microsoft.com/web/drupal<br />
    23. 23. Questions?<br />Thank You<br />Stop by the Microsoft Booth<br />Enroll in Website Spark today<br />Get a $5 Starbucks Gift Card<br />
    24. 24. © 2010 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 />