Hello, I have just committed initial work on enabling embedding PHP into C/C++ applications. It is mostly complete, but there a few pieces missing, namely the installation part. The modification of the build system adds another target, so in order to test the new functionality you need to configure php in the usual manner, and then do "make", "make install" and "make libs". Since libs are not installed by "make install" you need to copy libphp.so manually to appropriate directory.
The best way to explain how this works is to show you some code examples. pembed.c ======== #include <php_embed.h> int main(int argc, char **argv) { char *php_code = "echo \"Hello, World!\\n\";"; PHP_EMBED_START_BLOCK(argc, argv); zend_eval_string(php_code, NULL, "Embedded code" TSRMLS_CC); PHP_EMBED_END_BLOCK(); return 0; } Makefile (unix) =============== LIBS=-lphp $(shell php-config --libs) INCLUDES=$(shell php-config --includes) LIBDIRS=-L$(shell php-config --prefix)/lib PHP_EXE=$(shell php-config --prefix)/bin/php CC=gcc CFLAGS=-g -Wall pembed: pembed.o $(CC) $(CFLAGS) $(LIBDIRS) -o pembed $(LIBS) pembed.o pembed.o: pembed.c $(CC) $(CFLAGS) $(INCLUDES) -c pembed.c clean: rm -f *.o pembed Makefile (win32) ================ # Put your compiled php source here ROOT=u:\projects\php\php4.sdk LIBS=php4ts.lib phpembed.lib INCLUDES=-I "$(ROOT)" -I "$(ROOT)\main" -I "$(ROOT)\Zend" -I "$(ROOT)\TSRM" LIBDIRS=/libpath:"$(ROOT)\Release_TS" CC=cl LD=link CFLAGS=-MD -D ZTS -D PHP_WIN32 -D ZEND_WIN32 pembed.exe: pembed.obj $(LD) $(LIBDIRS) /out:pembed.exe $(LIBS) pembed.obj pembed.obj: pembed.c $(CC) $(CFLAGS) $(INCLUDES) -c pembed.c clean: -del *.obj -del pembed.exe As you can see from the example pembed.c file it is not very difficult to get the PHP engine started using php/embed. There are some things that you need to notice: you should think of PHP_EMBED_START_BLOCK() and PHP_EMBED_END_BLOCK() as {} block, so take care not to intersect with other {} blocks. If this is too great a limitiation, functions int php_embed_init(int argc, char **argv PTSRMLS_DC); void php_embed_shutdown(TSRMLS_D); should be used instead. I'm looking forward to your feedback and help to get the "make install" part working. Edin -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php