I'm using php5 and PDO to create a sqlite database.
Here is the php code :
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
try {
$dbh = new PDO("sqlite:/srv/www/htdocs/lowi.sqlite");
} catch (PDOException $e) {
die ($e->getMessage());
}
$query = "CREATE TABLE setting (
id INTEGER AUTOINCREMENT PRIMARY KEY,
title TEXT,
subTitle TEXT,
ssid TEXT,
defaultUrl TEXT,
imageBannerPath TEXT,
imageProfilePath TEXT,
loginAdmin TEXT,
passwordAdmin TEXT,
moderationActive TEXT CHECK(moderationActive IN ('T','F'))
)";
try {
$dbh->exec($query);
} catch (PDOException $e) {
echo $e->getMessage();
}
echo "Table 'setting' created successfully<br/>";
$dbh=NULL;
?>
It just outputs :
Table 'setting' created successfully
I checked the permissions and my webserver runs under the user/group : lighttpd (for both)
The directory in which I create the sqlite database has those permission :
drwxrwxr-x 4 root lighttpd 4096 Sep 9 16:15 /srv/www/htdocs/
and the database file is created and has those persmissions :
-rw------- 1 lighttpd lighttpd 0 Sep 9 15:48 /srv/www/htdocs/lowi.sqlite
The problem is that it remains an empty file and when I try to execute other queries like insert or select, it executes them without error (like the create table) but those queries have no effect.
NOTE : I know I'm not making good choices here in term of security (the database file in a public directory ...) No need to tell me such things as I'm trying to debug I changed losts of things and I'm just giving the current situation I'm in as close to as it is in my development machine to have better answers. :)