Maybe there's a PHP module that trumps this, but I see two good ways to
do it:
One approach would be to run a Tcl XML-RPC server behind the firewall
and let your PHP code make XML-RPC client calls to it. It's not as
efficient as an embedded Tcl interpreter for PHP would be, but it would
beat the living daylights out of execing out to Tcl repeatedly.
Another approach would be to install Apache's mod_tcl, make your
libraries callable from it on localhost, and use PHP's virtual() call:
http://www.php.net/manual/en/function.virtual.php
This has the potential for fastest performance, but it ties your Tcl to
the same machine as your PHP and would add the memory overhead of a Tcl
instance to each Apache process. Since it works like a server-side
include, it's up to you to parse what gets returned into something PHP
can evaluate. XML-RPC will return variables ready to go.
--
Steve Koppelman
http://www.hatless.com/
David McTavish wrote:
Hi all,
I'm just picking up PHP, and am really appreciating the transition, however,
I'm running into somewhat of a loggerhead. I'm trying to find a way to
utilize our existing code infrastructure (primarily written in TCL), while
providing an outlet for new technology (aka PHP). It seems that Tcl isn't
really well suited for integration with HTML pages (Rivet is fine, but not
as fleshed out as PHP seems to be). I was wondering if there is any
mechanism in which I can make embedded calls from PHP to TCL libraries? My
first priority would be for these processes to be somewhat embedded (ie:
avoid using a cgi-approach to invoke a new instance of Tcl each time the
particular page is requested via Apache).
Any advice is greatly appreciated! Cheers!
d.