Is it possible to mix python with php?

J

JL

Python is my favorite language. Very often, I am forced to use other languages like php because of better library support for web applications. Is it possible to write functions in python and then get php to call these functions?

Thank you
 
C

Chris Angelico

Python is my favorite language. Very often, I am forced to use other languages like php because of better library support for web applications. Is it possible to write functions in python and then get php to call these functions?

What sort of libraries are you needing? Often you'll be able to call
on those libraries from Python directly (eg if they're written in C,
they may well have Python as well as PHP bindings). Have a look on
python.org and PyPI for what you're after - chances are it already
exists.

ChrisA
 
R

Roy Smith

JL said:
Python is my favorite language. Very often, I am forced to use other
languages like php because of better library support for web applications. Is
it possible to write functions in python and then get php to call these
functions?

At one time, Songza was half PHP, half Python. The parts ran in
separate processes, communicating over HTTP. I think that's probably
what you want to do here.

If you define a clean, and well-documented interface, nobody has to know
what language is running behind it. Even better, if you have a
comprehensive test suite for each interface, you can swap out
implementations with a fair degree of confidence that you haven't broken
anything.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top