Download presentation
Presentation is loading. Please wait.
Published byRalph Nichols Modified over 9 years ago
1
1 Hosting PHP on IIS 7.0 Best Practices for shared hosting Microsoft® Hosting Deployment Accelerator
2
2 Agenda PHP Setup FastCGI architecture Hosting guidance Multiple PHP versions Per-site PHP configuration Providing URL rewriting Managing CPU usage Summary
3
3 PHP setup steps Copy binaries Use zip file with non-thread safe binaries Alternatively - download PHP installer Configure php.ini fastcgi.impersonate = 1 cgi.fix_pathinfo = 1 open_basedir = “C:\Websites\” Configure IIS Enable CGI Configure FastCGI handler mapping for *.php Change FastCGI settings Test that it works C:\php\php-cgi.exe –info http://localhost/phpinfo.php
4
4 FastCGI process pool for PHP5 FastCGI Handler Architecture IIS Worker Process FastCGI protocol over named pipes or TCP Request queue
5
5 App Pool #1 (user1) Web site #1 Recommended configuration FastCGI Process Pool …… App Pool #2 (user2) Web site #2 FastCGI Process Pool App Pool #N (userN) Web site #N FastCGI Process pool
6
6 Recommended configuration Configure security isolation One app pool per web site Enable FastCGI impersonation Prevent failures caused by PHP recycling set PHP_FCGI_MAX_REQUESTS >= instanceMaxRequests For higher site density: use dynamicIdleThreshold reduce idleTimeout reduce maxInstances (may affect performance)
7
7 Enhance your PHP hosting offer Support both PHP 4.X and 5.X on the same server Allow customers to choose PHP version Enable hosting of PHP apps that require tweaks to php.ini Provide your customers with flexibility of changing PHP configuration Use URL rewrite module to implement sub-domains support Easily enable sub-domains Expose rich set of IIS tools for creating and testing of rewrite rules Provide URL rewriting functionality
8
8 Multiple PHP versions App Pool #1 (user1) Web site #1 Process Pool for PHP 5 App Pool #2 (user2) Web site #2 Process Pool for PHP 4 C:\PHP526\php-cgi.exe C:\PHP447\php.exe
9
9 Per-site PHP configuration App Pool #1 (user1) Web site #1 Process Pool #1 App Pool #2 (user2) Web site #2 Process Pool #2 PHPRC=“C:\inetpub\website1\” PHPRC=“C:\inetpub\website2”
10
10 Per-site PHP configuration Configuring FastCGI process pool Combination of fullPath and arguments uniquely identify FastCGI process pool definition PHPRC environment variable contains path to the php.ini file
11
11 Per-site PHP configuration Configuring Handler Mapping <add name="PHP via FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\PHP\php-cgi.exe|-d my.website=website2" resourceType="Unspecified" requireAccess="Script" /> Reference FastCGI process pool by concatenating [fullPath]|[arguments]
12
12 Providing URL rewriting
13
13 Manage CPU utilization Windows Server Resource Manager (WSRM) Available in all SKU’s of WS2008 Ensures that process gets *at least* the configured CPU percentage Kicks in only if overall CPU load is more than 70% IIS team tested with 4000 web sites
14
14 Using WSRM
15
15 Best practices summary Follow IIS 7.0 security isolation guidelines Leverage FastCGI/IIS features to enhance hosting offer: Multiple PHP versions Per-site PHP configuration URL rewriting Use WSRM to manage w3wp.exe and php- cgi.exe CPU utilization More information at http://learn.iis.net/page.aspx/208/fastcgi-with-phphttp://learn.iis.net/page.aspx/208/fastcgi-with-php
16
16
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.