PHP embedded in D.

Alan Knowles alan at akbkhome.com
Tue Jul 3 19:41:38 PDT 2007


Using PHP embed, you should be able to initiate a PHP session, quite 
easily.
This is some of my very old code, that should give you an idea of how to 
use it in C
http://cvs.php.net/viewvc.cgi/pecl/bcompiler/examples/embed/

I would recommend writing a small C wrapper and then binding that. - as 
then you dont have to deal with the Macro expansion in D.

Interacting with the PHP script once running would be very difficult, as 
PHP's backend is a monster of Macro's which work in different ways 
depending on the various build options. And the whole action of creating 
variables, symbols etc. uses them throughout.

In essence you could easily use D as a controller to start up PHP 
scripts using phpembed, but I would not bother doing any more than that..
- you may as well just use PHP cli scripts.. and pass data in other ways..

Regards
Alan




Joshua wrote:
> Greetings All,
> 
> Well I am now learning D and as part of the process I am making a GA in D for a game I am working on. Since the games scripting is in PHP and Ruby I need a way to run these scripts in D. Has anyone tried using something like PHP-embed in D?
> 
> I can use the PHP CLI if I really must but I would prefer just using the some sort of PHP api directly. 
> 
> Thanks.



More information about the Digitalmars-d mailing list