views:

181

answers:

3

I'm going to help my friend in a improve of his phpBB board, but I want to make somethings there in Python or Perl. But it's possible to integrate these languages with PHP?

+8  A: 

You can always call the python or perl interpreter from within PHP! Minimalistic interchange is possible by means of passing command line arguments and capturing stdout (exec or passthru are related php functions).

However, I don't think its's a good idea - using two interpreters instead of one doubles the overall runtime overhead and startup time.

Alexander Gessler
...and increases code maintenance costs.
Mark Byers
It doesn't double startup time, it'll increase it a hundredfold. Not starting interpreters for each request is the reason FastCGI/SCGI exist. You'll be killing that, reverting to the old CGI method of starting processes constantly.
Glenn Maynard
+7  A: 

I'd say that the only reasonable way of doing that is if you are making a separate service, that you talk to via Ajax or XML or something like that. Everything else is more trouble than it's worth.

Lennart Regebro
This also helps later on if you start scaling across multiple boxes
gnibbler
Pretty much any RPC mechanism will work, as long as it has good support in P(erl|ython) and PHP.
daotoad
+2  A: 

There is Perl PECL package to integrate Perl into PHP.

Alexandr Ciornii