On Tue, 18 May 2010 14:30:06 +0100 (BST), Swithun Crowe
<swit...@swithun.servebeer.com> wrote:
>If you use PDO, then you get access to Sqlite 3.x databases:
>
>http://www.php.net/manual/en/ref.pdo-sqlite.php

Thanks for the input. After following the following article, I
successfully installed Lighttpd in FastCGI mode + PHP5 and PDO to
access SQLite:

www.kernelhardware.org/lighttpd-and-php/

I'm having a problem, though, writing to a SQLite database located in
Lighttpd's www directory (/srv/www/lighttpd).

Could it be that the Www directory is off-limit to PHP scripts in
write mode? FWIW, PDO can succesfully find and open db.sqlite:
=============
<?php

try {
        #TEST $dbh = new PDO("sqlite:./doesnt.exist.sqlite");
        #SQLSTATE[HY000] [14] unable to open database file

        #$dbh = new PDO("sqlite:./db.sqlite");
        $dbh->exec("CREATE TABLE IF NOT EXISTS customer (id INTEGER
PRIMARY KEY, name VARCHAR(255))");
        $dbh->exec("INSERT INTO customer VALUES (NULL,'Dummy')");
        $dbh = null;

        print "Done";

} catch(PDOException $e) {
        echo $e->getMessage();
}

?>
=============

After running this script, the browser simply displays "Done", but
db.sqlite is 0-byte :-/

FYI, here's what I tried after successfully installing Lighttpd +
Lighttpd-fastci + PHP5 + PDO:
=============
# pwd
/srv/www/lighttpd

# ll
total 8
-rw-r--r-- 1 root root   0 May 18 15:27 db.sqlite
-rw-r--r-- 1 root root  20 May 18 15:15 info.php
-rw-r--r-- 1 root root 646 May 18 15:34 sqlite.php

# chown lighttpd.lighttpd ./*

<here, browser runs script>
http://localhost/sqlite.php:
"Done"

# ll
total 8
-rw-r--r-- 1 lighttpd lighttpd   0 May 18 15:27 db.sqlite
-rw-r--r-- 1 lighttpd lighttpd  20 May 18 15:15 info.php
-rw-r--r-- 1 lighttpd lighttpd 298 May 18 15:37 sqlite.php
=============

Any idea what it could be? Could it be because I'm using the FastCGI
mode?

Thank you for any hint.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to