Getting ASP.NET Core to Play Nice with PHP

Ray HuangFor those who have or want to have a mixed language site (e.g. ASP.NET Core 1.0 and PHP), you might notice that your PHP applications have stopped working, and you’ll get an error message like this:

HTTP Error 502.5 – Process Failure

Untitled-1

Don’t worry.  Nothing on our server or your site is broken.  You just need to modify the web.config file a bit or create one in the appropriate directory because the AspNetCoreModule is the default handler for processing files.

I’ll show you how in this guide where I have an ASP.NET Core 1.0 application in the root and WordPress in a sub-directory.  Since I don’t want to memorize web.config markup language, I’ll let IIS Manager do most of the work for me.

Log into your site using IIS Manager and highlight the folder WordPress was installed to, so that the web.config file in that directory will get modified or created if there isn’t one.

Double click on the Handler Mappings module.

IISManager

On your right, select View ordered List…

HandlerMappings

Using the Move Up/Move Down Actions, move PHP##_via_FastCGI to the top where ## represents the PHP version number that you are using.  This will create the necessary markup in the web.config file in the WordPress directory without affecting your other web.config files.

OrderedList

Now click on View Unordered List…

Highlight aspNetCore and click on Remove.  Don’t worry, this doesn’t delete the AspNetCoreModule.  It just removes the handler mapping (i.e. entry in the web.config file), and voila, your PHP application should be working again.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.