First of all, sorry for my bad english.
I'm trying to make an expert system with Prolog and PHP. I'm using MAMP and just make PHP work with Prolog (a simple function that returns "hi world" is called from PHP and it shows the text in HTML). This is the code I have for it:
<!DOCTYPE html>
<html>
<head>
<title> Test </title>
</head>
<body>
<?php
$direccionSWIPL = "/Applications/SWI-Prolog.app/Contents/MacOS/swipl";
$cmd = "nice -n15 $direccionSWIPL -f $direccionArchivo -g iniciar,halt";
$output = shell_exec($cmd);
echo($output);
?>
</body>
</html>
The function "iniciar" is supposed to ask the first question, lets say something like: "do you like dogs?" and it should wait for the answer: "yes". But instead it freeze there, once you call the function "iniciar" the web pages freezes and doesn't show anything. I debug it with Netbeans and the problem is that it show in the web page the first question, but it doesn't wait for an answer and instead it show the second question and so on in an infinite cycle.
I need a way to make it ask the first question, wait for the user to answer it and then ask the second question but I can't find anything about it. Any help is welcome. I try with WAMP in Windows but it doesn't even make the connection between Prolog and PHP correctly, but I guess it could be the same result.