Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- PHP unable to open database file
- Tim Streater
July 11, 2008, 5:43 pm
rate this thread
from the command line. It does one select followed by one insert on an
SQLite database. The db in question has permissions guo+rwx.
If I run it as a web page (this is under OS X Leopard), the select works
but the insert fails with this exception:
SQLSTATE[HY000]: General error: 14 unable to open database file
Any reason PHP cannot write to a file from apache?
Here is the script:
$dbh = new PDO ("sqlite:/opsdb");
$dbh->setAttribute (PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$resq = $dbh->query ("select firstname from contact where absid=1");
$resn = $resq->fetchAll ();
echo "Name = '" . $resn["firstname"] . "'<br>\n<br>\n";
$res = $dbh->query ("insert into contact (absid) values (null)");
$absid = $dbh->lastInsertId ();
echo "absid='" . $absid . "'<br>\n";
Thanks -- tim
- The Natural Philosopher
July 11, 2008, 10:40 pm