Can PHP and ASP.Net run together within the same web site in IIS 7.5?

91,332

Solution 1

You should be able to run both in the same site, but be sure that the AppPool for the site runs a "classic" ASP.NET pool configuration. The default AppPool routes everything through ASP.NET, and you won't want that for your PHP pages.

Other than that, you should be fine. Query strings, files, and back-end databases will be the best way to share data between pages.

Solution 2

Yes you can use both under the same website. Since the file extensions are mapped to specific external processes, they are called independently. You can even use Asp.Net to secure .php files with FormsAuthentication by implementing wildcard mappings within IIS (I know 6/7 have this, not sure about 5). Mixing data across them is tricky because they will have separate external processes and thus separate sessions. Most cookies will be readable across both, but secured cookies will not be.

Solution 3

Yes you can, but watch out for this:

If you have a wordpress on your "root", and asp.net apps in folders under it

(e.g. http://root.com/aspnetapp1/), and if you follow these suggestions about "urlrewrite" for permalinks in wordpress, you can have trouble if you try to configure "wildcard handlers" in the apsnetapp1.

To avoid issues, the web.config of the wordpress root app must also have that setting:

    <location path="." inheritInChildApplications="false"> 
    <system.webServer>
...
    </system.webServer>
</location>

Or else, your wildcard handler will never raise because index.php from root will catch all your requests to url like: http://root.com/aspnetapp1/api/*

Solution 4

Yes, it will be not a problem. Even some Windows Shared Hosts offer PHP plans - Windows Hosting PHP.

Solution 5

Yes, PHP can be seamlessly implemented into ASP.NET 3.5 / 4.0

Go to http://phalanger.codeplex.com/ (or http://www.php-compiler.net/) and download the latest version of Phalanger. Install into Visual Studio and voila!

Phalanger – the PHP compiler for .NET

Welcome to Phalanger – full-featured PHP runtime & compiler for .NET/Mono frameworks. Phalanger is modern open-source implementation of PHP, compatible with the vast array of existing PHP code. In addition Phalanger gives PHP-application developers lot of new possibilities; from improving performance and using modern environments, to taking advantage of seamless unique .NET integration.

Share:
91,332
Aaron
Author by

Aaron

Updated on September 28, 2020

Comments

  • Aaron
    Aaron over 3 years

    A portion of our site is done in PHP and a portion of our site is done in ASP.Net. We just set up a new web server with Windows Server 2008 R2 which has IIS 7.5 installed.

    I understand that IIS 7+ supports PHP, but can PHP and ASP.Net run side-by-side within a single web site in IIS, or would I have to set up one web site for the PHP pages and one web site for the ASP.Net pages?