2

I would like to return a PHP page from a route handler like so:

return BuildManager.CreateInstanceFromVirtualPath("/redirects.php", typeof(Page)) as Page;

This requires an extra buildProvider and returns a page with PHP directives unprocessed, so I can view all the PHP code with View Source. How can I tell it to process the code rather than just output the page?

Shagglez
  • 1,522
  • 3
  • 21
  • 38

2 Answers2

1

It's unusual to want ASP.NET and PHP on the same server. The answer is that you need to install the PHP interpreter on your server.

I presume you're using using IIS. This seems like a good place to start: http://php.iis.net/

Spudley
  • 166,037
  • 39
  • 233
  • 307
  • I have PHP installed, I can serve PHP pages via URL, I was just wondering whether there was a way to build pages dynamically via BuildManager – Shagglez May 10 '11 at 07:57
  • hmm.. okay. sorry if I was barking up the wrong tree there. :) I've done a bit more digging and haven't found anything useful for you. The closest I got was this: http://stackoverflow.com/questions/4761769/can-php-and-asp-net-run-together-within-the-same-web-site-in-iis-7-5 (here on SO), where the accepted answer implies that sharing data between the two is best achieved with query strings and databases. – Spudley May 10 '11 at 08:28
  • 1
    Hmm interesting, we actually have a number of sites running both ASP and PHP in Integrated Mode, which works well. Most communication with DB is done via WebServices, but PHP also accesses it directly sometimes. The best solution at the moment seems to use web.config for basic routing and error handling without use of C# handlers. – Shagglez May 10 '11 at 09:25
0

You would have to call it as a URL. Using CURL or something. I'm not sure what the C# equivalent is.

Toby Allen
  • 10,997
  • 11
  • 73
  • 124