A simple yet dangerous and rather rubbish solution (possibly more of a
hack than a real implementation) could be achieved by using a
technique described above:

<?php
        echo exec('python foo.py');
?>

What is rubbish about that - except from the obvious cleansing of input variables that has to take place? Python has a whole module dedicated to that rubbish, called subprocess.

I would look into pyphp though. This method has so many issues
attached to it it's hardly worth bothering with.
I'm with Nick when I say why on earth are you needing to call Python
from within PHP as opposed to using only Python or only PHP?


While I certainly prefer to use Python wherever I can, that does not mean that there aren't cases where legacy systems or other constraints make this impossible. If I have e.g. a type3-based website - "how on earth" should I replace that with Python (without wasting a lot of time)?

Diez
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to