• Like
  • Save
Running PHP on Windows Technical Overview
Upcoming SlideShare
Loading in...5
×
 

Running PHP on Windows Technical Overview

on

  • 6,270 views

Running PHP on Windows Technical Overview

Running PHP on Windows Technical Overview

Statistics

Views

Total Views
6,270
Views on SlideShare
6,268
Embed Views
2

Actions

Likes
0
Downloads
6
Comments
0

1 Embed 2

http://www.slideshare.net 2

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

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

Running PHP on Windows Technical Overview Running PHP on Windows Technical Overview Presentation Transcript

  • Running PHP on Windows Server name title Microsoft
  • Session Prerequisites
    • Familiarity with hosting PHP applications
    • Familiarity with the IIS Web server
  • Session Objectives And Agenda
    • Objectives
      • Learn how to host existing PHP applications on IIS
      • Learn how to take advantage of IIS7 to extend existing PHP applications with ASP.NET
    • Agenda
      • Running PHP applications on IIS6 and IIS7
      • Deploying and managing PHP applications on IIS7
      • Extending PHP applications with IIS7
      • Best practices
  • IIS6 Application Framework support
    • Common Gateway Interface (CGI) for CGI and PHP applications
      • Benefits
        • Very simple to implement and use – single-threaded execution
      • Disadvantages
        • Poor performance due to high process creation cost
        • Creates and passes request data to a new CGI process
        • Waits for CGI process to produce response
        • Shuts down CGI process
  • IIS6 Application Framework support
    • Internet Server Application Programming Interface (ISAPI)
      • Benefit of ISAPI
        • Can be extremely fast when written correctly
      • Disadvantage of ISAPI
        • Must be thread-safe (many PHP extensions are not!)
        • Requires development in C++
  • FastCGI in IIS7
    • FastCGI: the best of both CGI and ISAPI
      • Enhancement to CGI protocol
      • Web server creates FastCGI process for very first request
      • Web server re-uses existing FastCGI process for subsequent requests
      • Ships as part of IIS7, installed with the CGI feature
    • Benefits of FastCGI for Windows OS
      • Much faster than CGI because there is no process creation cost
      • Much more stable than ISAPI because of single threaded execution environment
    Non-thread safe PHP build is recommended for FastCGI
  • FastCGI Handler Architecture IIS Worker Process Request queue FastCGI process pool for PHP5 php-cgi.exe FastCGI process pool for PHP4 php.exe FastCGI protocol over named pipes or TCP
  • FastCGI for IIS6
    • Same FastCGI functionality as in IIS7, available as a separate download for IIS6 from the Microsoft download center
      • <add link here when we have it>
      • Fully supported by Microsoft
    • Walk-throughs demonstrating how to run popular PHP applications on Windows Server
      • See http://www.iis.net/php
    • Close collaboration with Zend Technologies
      • Improvements in PHP engine for IIS with contributions and collaboration back to PHP Community
      • Zend Core Available for Commercially Supported PHP
  • PHP with CGI vs. FastCGI on IIS6
  • FastCGI in IIS6 and IIS7 FastCGI in IIS6 FastCGI in IIS7 Available today on Download Center Available with Longhorn Server and Vista SP1 Delivered as a separate download from Windows Server 2003. Delivered as part of IIS7. Users must install the CGI feature in IIS to enable FastCGI. ISAPI extension Native IIS7 module Resources, forums, and reference material available on IIS.NET Product help documentation, as well as resources on IIS.NET. Configured via fcgiext.ini Configured via the new XML-based configuration system in IIS7. Fully supported by Microsoft Supports PHP and other FastCGI frameworks
  • Installing FastCGI and PHP on IIS7
  • Deploying PHP applications on IIS7
    • Control IIS configuration for PHP applications via web.config
      • Example: setting default document for PHP application
    • Run PHP applications in the new IIS7 integrated pipeline with ASP.NET and other web applications
      • Extend existing PHP applications with rich ASP.NET functionality
      • Develop new .NET modules that run in the integrated pipeline to handle PHP requests the same way as the module handles requests for ASP.NET content.
      • Example: URL Rewriter that makes “pretty” URLs for PHP and ASP.NET content.
  • Extending PHP in the Integrated Pipeline
    • IIS7’s Integrated Pipeline enables ASP.NET to serve as the standard .NET extensibility mechanism for IIS7.
    • Provides the same familiar ASP.NET APIs and features for building web applications.
    • ASP.NET provides a rich application framework for rapid application extensions to existing PHP applications.
    Example: Adding Access Control to an existing PHP application…. Using PHP Using ASP.NET Building a custom credential store and cookie-based authentication from the ground up.
      • Rich membership service, built-in credential store providers, the forms authentication module, and
    • a set of pre-made Login controls.
  • Extending Existing PHP Applications with ASP.NET in the IIS7 Integrated Pipeline
  • Best Practices for Running PHP on IIS7
    • Want to ensure that a new process is created if no processes are available to handle a request?
      • Run one instance per CPU with a minimum of 4 instances
      • Set maxInstances to the lowest possible number under full load without consuming 100% CP
    • Want to make sure that the existing process is recycled periodically?
      • Set instanceMaxRequests (number of requests to process before recycling) as high as possible without destabilizing the app
      • PHP process’ maximum request setting (PHP_fcgi_max_requests) has to be equal or higher than the instanceMaxRequests setting.
    • <fastCgi>
      • <application fullPath=&quot;C:PHPphp-cgi.exe&quot;
      • maxInstances=&quot;4&quot;
      • instanceMaxRequests=&quot;10000&quot;
      • idleTimeout=&quot;300&quot;/>
    • </fastCgi>
  • Best Practices for Running PHP on IIS7
    • Want to set PHP specific environment variables in the web.config file?
      • Use environmentVariables configuration setting to set PHP specific environment variables.
    • <fastCgi>
      • <application fullPath=&quot;C:PHPphp-cgi.exe&quot;
      • instanceMaxRequests=“10000&quot;>
      • <environmentVariables>
      •     <environmentVariable
      • name=”PHP_FCGI_MAX_REQUESTS”
      • value=”10000”/>
      •     </environmentVariables>
      • </application>
    • </fastCgi>
  • Best Practices for Running PHP on IIS7
    • Is your server under so much load that your clients are getting timeout responses?
      • The FastCGI process will be terminated if it does not respond to FastCGI handler within specified time period.
      • Set the requestTimeout (number of seconds to wait for process to handle the request) value to be higher than the activityTimeout (number of seconds to wait for any process activity) value.
    • <fastCgi>
      • <application fullPath=&quot;C:PHPphp-cgi.exe&quot;
      • activityTimeout=“30&quot;
      • requestTimeout=“90&quot;/>
    • </fastCgi>
  • FastCGI Process Management
  • FastCGI Best Practices
    • Want to use FastCGI process security context?
      • Application pool identity is used for FastCGI process
      • Use fcgi.impersonate PHP setting if client impersonation is necessary
    • Need support for FastCGI and PHP on Windows Server?
      • http://forums.iis.net
    • Looking for support from the community?
      • http://www.iis.net/php
    • Want to ensure serviceability and patching of PHP for business critical apps?
      • Consider Zend’s commercial offerings (Zend Core)
    • Need FastCGI for IIS6 installations?
      • FastCGI Extension for IIS6 is now available for download!
  • Summary
    • FastCGI for IIS6 is now available for download! <insert link>
    • FastCGI radically improves the reliability and performance for existing PHP applications on both IIS6 and IIS7
    • The new integrated pipeline in IIS7 introduces the ability to extend existing PHP applications with ASP.NET, as well as develop managed modules that handle requests for any web application (ASP.NET, PHP, Ruby, etc.) in the request pipeline
  • IIS.NET: Home for IIS Community!
      • In-depth technical articles and samples
      • Connect with other IIS experts on blogs & forums
      • Free advice and assistance in forums
      • Download center with IIS solutions