Page 1 of 1

PHP and SWI-Prolog

Posted: Wed Feb 03, 2010 12:08 pm
by SmokOO
Hi!

I'm trying to launch SWI-Prolog in php by using exec() function... and with no results. Here's how it looks:

prolog file test.pl

Code: Select all

test :- write('Test complete').
and php code:

Code: Select all

exec('c:\\Program Files\\prolog\\bin\\plwin -L128k -G128k -T128k -A128k -f c:\\Program Files\\prolog\\files\\test.pl -g test,halt', $result2);
print_r($result2);
"-L128k -G128k -T128k -A128k" are memory settings for prolog (they are not necessary)
"-g test,halt" executing 'test' predicate and stopping

as a result i get " Array() "

Thx for any help!

Re: PHP and SWI-Prolog

Posted: Wed Feb 03, 2010 1:10 pm
by AbraCadaver
It been a while since I used windows so you may have to try different combinations, but the problem most likely is the spaces in your paths. Try something like this:

Code: Select all

exec('"c:\\Program Files\\prolog\\bin\\plwin" -L128k -G128k -T128k -A128k -f "c:\\Program Files\\prolog\\files\\test.pl" -g test,halt', $result2);

Re: PHP and SWI-Prolog

Posted: Wed Feb 03, 2010 2:37 pm
by SmokOO
tried it, still the same result :/