12
Nick Hodge Microsoft Australia Professional Geek [email protected] Jorke Odolphi Microsoft Australia Web Infrastructure Evangelist [email protected]

Microsoft, PHP and IIS7

Embed Size (px)

DESCRIPTION

Presented to the Sydney PHP User Group, 4th September 2008

Citation preview

Page 1: Microsoft, PHP and IIS7

Nick HodgeMicrosoft AustraliaProfessional [email protected]

Jorke OdolphiMicrosoft AustraliaWeb Infrastructure [email protected]

Page 2: Microsoft, PHP and IIS7

This is not your father’s Microsoft

Page 3: Microsoft, PHP and IIS7
Page 4: Microsoft, PHP and IIS7

IIS Request Processing

Server functionality is split into ~ 40 modules...Modules plug into a generic request pipeline…Modules extend server functionality through a public module API.

Send ResponseSend ResponseLogLog CompressCompress

NTLMNTLM BasicBasic

DeterminDetermine e

HandlerHandler

CGICGIStatic Static FileFile

ISAPIISAPI

AuthenticationAuthentication

AnonAnon

SendResponseSendResponse

AuthenticationAuthentication

Authorization

ResolveCache

ExecuteHandlerExecuteHandler

UpdateCache…

ASP.NET

PHP

Monolithic implementation Install all or all or nothingnothing…

Extend server functionality only through ISAPIISAPI…

Page 5: Microsoft, PHP and IIS7

IIS 6.0 ASP.NET Processing

Runtime limitations

Only sees ASP.NET requests

Feature duplication

Send ResponseSend ResponseLogLog CompressCompress

NTLMNTLM BasicBasic

DeterminDetermine e

HandlerHandler

CGICGIStatic Static FileFile

ISAPIISAPI

AuthenticationAuthenticationAnonAnon

AuthenticationFormForm

ssWindowWindow

ss

Map Handler

ASPXASPXTraceTrace

………

aspnet_isapi.dll

Page 6: Microsoft, PHP and IIS7

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

Page 7: Microsoft, PHP and IIS7

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++

Page 8: Microsoft, PHP and IIS7

PHP Setup

Page 9: Microsoft, PHP and IIS7

Per-site PHP configurationConfiguring FastCGI process pool

<fastCgi> <application fullPath="C:\PHP\php-cgi.exe" arguments="-d my.website=website1"> <environmentVariables> <environmentVariable name="PHPRC" value="C:\WebSites\website1" /> </environmentVariables> </application></fastCgi>

Combination of fullPath and arguments uniquely identify FastCGI process pool definition

PHPRC environment variable contains path to the php.ini file

Page 10: Microsoft, PHP and IIS7

IIS Extensions

Mod_rewrite support for URL rewriting

Page 11: Microsoft, PHP and IIS7

SQLServer 2008

Express version with Management Studio Free (as in beer) download

MySQL .NET drivers (data import/export)

Open source: Microsoft SQLServer Driver for PHP

Page 12: Microsoft, PHP and IIS7

Resources

http://learn.iis.nethttp://learn.iis.net

http://port25.technet.comhttp://port25.technet.com

http://codeplex.com/http://codeplex.com/http://port25.technet.com/archive/2008/07/25/osp.aspxhttp://port25.technet.com/archive/2008/07/25/osp.aspx