On Wed, 30 Mar 2005 02:43:18 -0500, "Chung Leong" <ch***********@hotmail.com>
wrote:
"Thomas Gagne" <tg****@wide-open-west.com> wrote in message
news:OY********************@wideopenwest.com... I anticipate wanting PHP to evaluate a lot of expressions and would
rather not create subprocesses to do it from inside my C program.
I've googled around for calling PHP from C, and know Apache does it, but
my C program won't have a full Apache environment. Can the libphp.so be
used otherwise?
You will never be able to use libphp.so without building Apache into your C
program. The PHP module calls a number of functions within Apache. Unless
you implement your own version of these, the dynamic library will not even
load.
That's exactly what the embed SAPI is for. Clearly it's possible to load PHP
into an executable without Apache being involved at all - else running PHP
under IIS would be impossible.
The embed SAPI, from the looks of it, fills all the gaps usually provided by a
webserver's API, allowing PHP to be called from arbitrary C programs.
It's woefully underdocumented and from a few minutes playing with it I've not
got it to actually link properly yet, but the principle looks sound.
--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool