I'm new to this forum and a little bit with the Prolog programming language. I am currently working on a project based on an Expert System with web interface, using SWI-Prolog, based on a contribution made in another forum ( link ) that talks about how to make a query to SWi-Prolog through Php code. By following the steps indicated in said forum I could successfully make the call of SWI-Prolog from Php, obtaining the corresponding message in the browser. When I went directly to consult the .pl file that I had done for my project, I could not get any answer on the screen. In my .pl file (It works correctly in the SWI-Prolog console) I make a call to an external database through odbc_connect, from where I obtain certain data that I then proceed to display in the browser. When doing certain tests, I noticed that when calling a .pl file from Php and that the query requires a connection to an external database, this will not be done, therefore, by not complying with one of the rules of the query , this will not return any response. Why does that happen? Is it not possible to make the query from Php to SWI-Prolog and this in turn consult an external database?
PS: I'm using Wampserver with local server.
Below is part of the code in Php and a Prolog test code, to which I ask and if the connection is made successfully it will show the "Hello" on screen (when testing it in the SWI-Prolog console it works correctly, just like in the Windows console).
index.php:
<?php
if(!file_exists("Prueba2.pl")) die("No se puede localizar el archivo .pl, el
directorio actual es: ".__DIR__);
$output = 'swipl -s Prueba2.pl -g "abrir_conexion." -t halt.';
print_r($output);
?>
Prueba2.pl:
abrir_conexion:-
odbc_connect('MSprolog',_,
[user(root),
password(''),
alias(prolog),
open(once)]),
write('hola').