My php-script works perfectly, if I execute it in a shell ($ php test.php
). But if I call the same php-file in my web-browser it just works in parts.
I work on a Debian4.9-System, the php-file is in /var/www/html/
(will change this). I suspect, that it is some rights-issue, but I don't know what exactly and how to solve it. How can I give www-data
(or who?) permission to execute the php module ARC2 and make a SPARQL request from my Fuseki 2 Server?
My MWE:
<html>
<body>
<?php
include_once("semsol/ARC2.php");
$config = array (
'remote_store_endpoint' => 'http://localhost:3030/test/query',
);
$store = ARC2::getRemoteStore($config);
$query = 'SELECT * WHERE {?s ?p ?o} LIMIT 10';
$rows = $store->query($query, 'rows');
echo "<table>";
foreach ($rows as $row) {
print "<tr><td>" .
$row['s'] . "</td><td>" .
$row['p'] . "</td><td>" .
$row['o'] . "</td></tr>" ;
}
echo "</table>";
?>
</body>
</html>
In console it parses well, in browser it stops at <html><body>
.