tags:

views:

919

answers:

3

I want to use Prolog with PHP. Is it possible?

+3  A: 

There are always the exec-familiy functions to execute/spawn another process.

VolkerK
+1  A: 

Most Prologs allow for prolog code to be compiled into a binary. You could try calling this binary from within PHP using some kind of process call as already mentioned.

humble coffee
+1  A: 

As suggested above, you can execute a Prolog interpreter or binary. However, most Prolog implementations also export a C api that can be used to call the Prolog interpreter. You could create a small PHP module to start an interpreter and execute queries. For instance, the Sicstus documentation describes using Prolog from C in detail:

http://www.sics.se/sicstus/docs/latest4/html/sicstus.html/Mixing-C-and-Prolog.html#Mixing-C-and-Prolog

Daniel de Kok