-1

Is it possible to use more that one scripting language in a single file of a web page? For example, I want to use python and ether php in my web page? Is it possible or not? I mean, have python a module to parse files like this? or any possibility on other web servers? Something like this:

[File Erfankam.ppp]

<php script part>
    Some thing in php
</php script part>

<html part>
    something in html
<html part>

<python script part>
    Some thing in python
</python script part>

<html part>
    something in html
<html part>

<perl script part>
    Some thing in perl
</perl script part>

I hope I was not wrong.

4
  • 2
    You might want to re ask this question and talk specifically about what you are trying to achieve. Using multiple server side languages seems like a ridiculous idea but since we don't know what you actually want to do it's hard to comment. People normally use one SERVER side language and one CLIENT side language to present a web page. Commented Jun 20, 2012 at 8:48
  • Thanks for you notation. I know it s so not normal to use more than one server side scripting language, But I just want to know is it possible? Actually I m working on a small web server project and I like to know about it that should I implement on my project or not? Commented Jun 20, 2012 at 19:36
  • You should consider going the other way: nodejs.org Commented Jun 20, 2012 at 22:59
  • I cant understand. What do you mean? Commented Jul 15, 2012 at 15:57

1 Answer 1

4

You could use Python to return a response that was a PHP script which was then further processed by the PHP processor. But it would always be a sequential process. So each stage would be handled by a different interpreter.

I cannot conceive of a good reason to do this.

On the other hand you could certainly serve a site that contained both PHP and Python scripts. Requests for different assets could be handled by either Python or PHP. This is easy enough to achieve when configuring a web server.

It would be possible to write some kind of parser that looked for specific tags and then processed the code inside those tags using the correct interpreter. But again not sure why you would want to do this. Some actual use cases might be interesting.

See this answer here for an example of how you can launch Python/Ruby from within a PHP script - How to run Ruby/Python scripts from inside PHP passing and receiving parameters?

Sign up to request clarification or add additional context in comments.

1 Comment

That s a good idea. But it s not what I mean. I edited post to make my opinion transparent. Thanks

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.