Hello
I'm having the following issue trying to access an SQLite 3.3.17
database from PHP+PDO under FreeBSD 6.3: I can read, but can't write,
with no error reported by PHP or /var/log/messages.
I've tried both Apache and Lighttpd as web server, to no avail.
Here's some information:
1. echo exec('id');
=> uid=80(www) gid=80(www) groups=80(www)
2. The PHP script and the SQLite database are owned by www:www:
============
[/usr/local/www/apache22/data]# ll
drwxr-xr-x 2 root wheel 512 Mar 24 19:52 .
drwxr-xr-x 6 root wheel 512 Mar 24 18:56 ..
-rw-r--r-- 1 www www 2463 Mar 24 20:00 test.php
============
[/usr/local/share/asterisk/agi-bin]# ll
drwxr-xr-x 3 root wheel 512 Mar 24 18:38 .
drwxr-xr-x 9 root wheel 512 Mar 14 08:05 ..
-rw-rw-r-- 1 www www 3072 Mar 24 18:37 test.sqlite
============
3. And here's the code:
============
//GOOD $dbh = new PDO("sqlite:test.sqlite");
//GOOD $dbh = new PDO("sqlite:/tmp/test.sqlite");
$dbh = new
PDO("sqlite:/usr/local/share/asterisk/agi-bin/test.sqlite");
$time = time();
$current = date("Y-m-d H:i:s",$time);
$sql = "INSERT INTO mytable VALUES (NULL,'$current')";
print "$sql<hr>";
$dbh->exec($sql);
$sql = "SELECT * FROM mytable";
foreach($dbh->query($sql) as $row) {
print $row['name'] . "<p>\n";
}
$dbh = null;
============
I don't understand why test.php can read, but cannot write. Could it
be that SQLite does something that requires 777 access to the
directory where the database file lives? Something else?
Thank you.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users