Recently I changed webhost for one of my Windows based website. After few issues I was able to run from new server. But an issue cropped up when we tried to run the WordPress based blog on the this ASP.net website, from a sub directory – “/content”. In this post I will explain the process to run a PHP based web site from a ASP.net based website.
I tried to install wordpress in a subfolder for blog on one of my website which was developed in ASP.net and running on a Windows Server. I uploaded the wordpress files (downloaded from wordpress download page) to a folder named “/content”. When I accessed /content folder, it showed me the Server Error 500. I contacted the support and they responded with generic responses and escalated the issue to their seniors and till the writing of this post, there was no response from Senior Support Staff. But I resolved the issue myself and posting the solution to Run PHP scripts from a running ASP.net website.
The .Net based website was provided with the control panel – Website Panel. And after some hit and trial I found out that the Default Document was set to Default.aspx (which is the default document for an ASP.net based website) as the highest priority.
As you can see in the following screenshot:
As a result web server i.e. IIS (Internet Information Server provided by Microsoft) was trying to find the Default.aspx and ASP.net website is configured with a Web site centric Configuration file – web.config at the root of the website, which is configured to return error if does not found Default.aspx in directory i.e. /content in this post. So we were getting Server Error 500.
After finding that the Default Document was having Default.aspx as the highest priority than index.php files. I moved the index.php above the Default.aspx and saved the settings.
What does this mean?
It means that when web server i.e. IIS (Internet Information Server provided by Microsoft) when tries to execute files from a Website Folder it will look for the files in the order defined by the Default Document, which is now set to index.php then Default.aspx and then others…
Final settings in the following screenshot:
I hope it will help you in running a PHP based website under your ASP.net website.