12

Suppose i have one website 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?

9 Answers 9

22

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.

0
10

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.

5

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.

5

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.

4

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.

3

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

1

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!

0

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.

0

You can use Apache Reverse Proxy to do it and session must be readable between programming languages. I use Go, NodeJS and PHP in one website. Session is saved in Postgresql. The hardest part is all programming that is used in your website can read session with same format and saved in same place. I have used github.com/yvasiyarov/php_session_decoder to read and save session with Go and save it in Postgresql so PHP can process that session

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.