I am working on a leaflet map site with access to real time weather data. To avoid having to use SUID, because of it's security problems, I am using symbolic links from /var/www to my imagery data. These are simple png files, and this is working.
I then wanted to have real time data based on mouse position hovering over the image data. For this, I created an SQLite3 database with the actual values. At first, as a test, I manually put this database in the site root, and everything worked out perfectly. Unfortunately I cannot have that database in that location. I then did the exact same procedure used for my imagery data (which worked) with this database.
The process was:
In my site root:
ln -sf /path/to/db/ db
chmod 777 /path/to/db/data.db
The file is then read by a simple PHP program for querying:
<?php
$lat = floatval($_GET['lat']);
$lon = floatval($_GET['lon']);
$db = new SQLite3('db/sst.db'); # line 6
$results = $db->query("SELECT sst FROM current ORDER BY (($lat-lat)*($lat-lat) + ($lon-lon)*($lon-lon)) ASC LIMIT 1");
while ($row = $results->fetchArray()) {
echo $row['sst'];
}
?>
Unfortunately, now I am getting this error in the browser console:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
Inspecting /var/log/apache2/error.log file I get the following error:
PHP Fatal error: Uncaught exception 'Exception' with message 'Unable to open database:
unable to open database file' in /var/www/Mapea/sst.php:6\nStack trace:\n#0
/var/www/Mapea/sst.php(6): SQLite3->__construct('db/sst.db')\n#1 {main}\n thrown in
/var/www/Mapea/sst.php on line 6