Calling Python code from inside php

alexelder at gmail.com alexelder at gmail.com
Fri Apr 25 13:37:23 EDT 2008


On Apr 25, 4:02 pm, sturlamolden <sturlamol... at yahoo.no> wrote:
> On Apr 23, 9:13 pm, alexel... at gmail.com wrote:
>
> > 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');
>
> This will spawn a Python interpreter, and not be particularly
> efficient. You could just as well have used CGI.

Thanks for pointing that out. I thought the warning before hand
could've suggested that this implementation wasn't the best. I'll be
more explicit in the future.



More information about the Python-list mailing list