Forum OpenACS Development: Re: Tcl calls from PHP?

13: Re: Tcl calls from PHP? (response to 1)
Posted by Andrew Piskorski on
Hm, well, as you say, getting a fresh, ignorant, born-just-now PHP interpreter for every single request is the normal mode of operation for PHP, right? So, since anything you can do in PHP is already limited by that, it seems to me that, pretty much by definition, if there is existing PHP functionality which you'd like to call from Tcl, the fact that it is impossible to save PHP interpreter state across requests shouldn't matter, right?

Or is there more to it that I'm missing here? In practice, why would a Tcl caller ever care about the fact that PHP has no persistent state at all?

14: Re: Tcl calls from PHP? (response to 13)
Posted by Patrick Giagnocavo on
Andrew, I don't think that is exactly the case concerning PHP.

However, what this means is that the cost of a single PHP command is thus the same as a CGI being forked.  The php.ini config file must be read, file handles opened, that sort of thing.  And you can, in fact, run PHP as a CGI.

I think the idea is not so much that PHP has persistent state, as that the cost of a PHP function be as small as a possible.  Having a persistent interpreter being around means no startup time.  Think of how having bash's builtin functions around all the time makes it easier and more efficient when you are doing things on the command line.