Wednesday, July 15, 2009

Running PHP and ASP at the same time for a single page?

Is it possible to make a script web page to be interpreted by both PHP and ASP (.Net) one after the other? If so, in what order (PHP must be interpreted first, or ASP must be interpreted first or both is possible)? Is there any practical use for this hybrid interpretation?





Technical answers only, please. Thanks.

Running PHP and ASP at the same time for a single page?
You could do that if you ran the page as ASP.NET and installed an ISAPI library that executed the PHP prior to ASP.NET page execution.





Or, you could possibly create a custom library that interprets the PHP code as its ASP.NET equivalent / converts PHP to ASP.NET objects, etc., then reference that in your ASP.NET assembly via some sort of abstraction, such as a custom control; maybe call it %26lt;asp:PHPInterpreter%26gt; or the like.





It may well be there is some project out there on the Web trying to do just that. Check http://www.sourceforge.net
Reply:oki.. there we go. php runs on apache.. asp does not run on apache ( it does.. but lets say its not for now ) if u have two web servers, u will have to redirect one of them to another port, i see no point in your idea, as its completely useless
Reply:if somehow you are able to configure you apache server to pass requests to IIS then and only thne you can make your page in such way that first you run ASP and then you run PHP.


I am pretty sure it won't work the other way around, but i don't know for certain.


In any case this would be a major pain...


why would you want to do this ???
Reply:You can install and run PHP and ASP on the same machine (and even invoke calls to both within the same page) but it's highly inadvisable.





When a call is made to one technology or the other on a webserver, the website code is passed to the proper interpreter (engine that translates the higher level code to executable machine code). Every time the web server has to switch back and forth, there is a massive cost in resources and latency.





There are only a few exceptions to this, for example one company built an embedded Cold Fusion environment to be run within an ASP.NET environment so that the Cold Fusion code would be supported in CLR (the Common Language Runtime all dotNET applications compile to no matter the language the code was written in).





So, unless you have one of these %26lt;very%26gt; special implementations the general rule is... DON'T.


No comments:

Post a Comment