|
How to map the PHP extension to ASP.NET 2.0 isapi-filter
I was trying to have webpages with the .PHP extension be processed by IIS 6
and ASP.NET 2.0. Here is the error that I was getting, "There is no
build provider registered for the extension '.php'. You can register one in the
<compilation><buildProviders> section in machine.config or web.config. Make sure
is has a BuildProviderAppliesToAttribute attribute which includes the value
'Web' or 'All'. After some research, I found a few settings
to make this work. I wanted to pass along my findings because when
searching on Google, there was only 2 results. This article covers the
basic syntax. http://arje.net/
#1
Add the PHP script mapping in IIS and point it to the ASP.NET 2.0 ISAPI-filter.

#2 and #3
After you add the script mapping to IIS 6. There are a couple of items to
add to the web.config. You have to add the HTTP Handler and
buildProviders option listed below.
<?xml version="1.0"?>
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="*.php" type="System.Web.UI.PageHandlerFactory"
validate="True" />
</httpHandlers>
<compilation debug="false"
batch="true" batchTimeout="120">
<buildProviders>
<add extension=".php" type="System.Web.Compilation.PageBuildProvider" />
</buildProviders>
</compilation>
</system.web>
</configuration>
If you don't have these don't have these settings you'll receive this
error.
Server Error in '/' Application.
There is no build provider registered for the extension '.php'. You can
register one in the <compilation><buildProviders> section in machine.config or
web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which
includes the value 'Web' or 'All'.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.
Exception Details: System.Web.HttpException: There is no build provider
registered for the extension '.php'. You can register one in the <compilation><buildProviders>
section in machine.config or web.config. Make sure is has a
BuildProviderAppliesToAttribute attribute which includes the value 'Web' or
'All'.
Source Error:
An unhandled exception was generated during the execution of
the current web request. Information regarding the origin and location
of the exception can be identified using the exception stack trace
below.
|
Stack Trace:
[HttpException (0x80004005): There is no build provider registered for the extension '.php'. You can
register one in the <compilation>
<buildProviders>
section in machine.config or web.config. Make sure is has a
BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.]
System.Web.Compilation.CompilationUtil.GetBuildProviderTypeFromExtension(CompilationSection config, String extension,
BuildProviderAppliesTo neededFor, Boolean failIfUnknown) +3364181
System.Web.Compilation.BuildManager.CreateBuildProvider(VirtualPath virtualPath, BuildProviderAppliesTo neededFor,
CompilationSection compConfig,
ICollection referencedAssemblies, Boolean failIfUnknown) +49
System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +230
System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean
allowCrossApp, Boolean
allowBuildInPrecompile) +580
System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath,
Boolean noBuild,
Boolean allowCrossApp,
Boolean allowBuildInPrecompile) +93
System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context,
Boolean allowCrossApp,
Boolean noAssert) +111
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType,
HttpContext context, Boolean
allowCrossApp, Boolean noAssert) +54
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath,
String physicalPath) +31
System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType,
VirtualPath virtualPath, String
physicalPath) +40
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String
pathTranslated, Boolean useAppConfig) +139
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +120
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
|
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
Version:2.0.50727.42
|
|