views:

337

answers:

8

Suppose i have one webiste with simple pages in php like

page1.php
page2.php

Now there is one page where i want some detailed functioning and i want to use python for that and it will look like

page3.py

and in other page i want to use java like

page4.jsp

Provided i have installed python , java on webserver.

Is it possible

+20  A: 

Yes. It's possible. Where you will find yourself in trouble is when you want to share server-side information among them (I.E. sessions).

Other than that, you can use (but I would advise against it) all languages you want on a website.

Pablo Santa Cruz
+1 for mentioning the sessions issue.
animuson
+5  A: 

Yes it is very possible, as long as the server can serve the files you want to use. If it doesn't have python, you can't use python.

Coltin
+3  A: 

Short answer: Yes, many web servers can handle generating pages from multiple languages.

mmsmatt
+4  A: 

It depends on the web server. Apache can do it. Just make sure you have the appropriate handler modules for each file type, and use the AddHandler configuration directive to map each type to the appropriate handler.

Forest
+9  A: 

Yes, it is possible, but you definitely should NOT do it.

Communication between pages running different technologies will not be elegant, if for no other reason than the fact that you won't get a shared session pool. Session bridges are possible, but they are a pain to do.

I would say you are making a mistake if you can't just pick a single language for your core web layer.

slifty
+3  A: 

Also, to be pedantic, you can not only use all three of those, but you can actually integrate them at the session level, since all of those languages are available on the JVM. So, in one container you can run all of the PHP, Python, and Java code. You can share session state, reuse connections to the database (via server wide connection pools), leverage Java libs in your PHP and/or Python code, etc.

I'm not saying this will be "drag and drop" easy, but it is possible, and even practical if you need that kind of close integration (vs integration via a database or filesystem). There will likely be nuances in ensuring that the Python and PHP code runs properly on the Java implementations as well.

Will Hartung
A: 

I work for a PHP development company and all the time these ASP.Net companies come to US for whatever reason I've never understood. We build them forms in PHP usually dynamically pulling in the layout - sometimes hosted on a subdomain, sometimes hosted directly in IIS with the PHP module. Its very messy and bad, it can be done but I'd say avoid it.

donatJ
A: 

People are talking about session...

Almost all server side technologies today support custom session providers, where you can hook up some code to share you session between different HTTP modules and binders.

If you are starting to write a web site from scratch, and you need to write all of your code for yourself, than probably you will choose to do it in one programming language (only for your comfort of coding).

But... where it's all starting to change? When you want to mash-up some open source and community source code to make a web site. Let's say a store & community with ASP.NET to mix up with CRM like Sugar CRM (which is in PHP). In that case you don't need any session sharing, just users sync procedure in the DB. Also, if you choose IIS 7 (Windows Server) or Apache (using Mono project you can run ASP.NET on LAMP), you could run them both on the same machine.

And remember, the most important thing is TIME TO MARKET! So saving code time can be crucial for you success.

ENJOY!

Yuki