On Tue, 18 May 2010 15:57:37 +0200, Michal Seliga
<michal.sel...@visicom.sk> wrote:
>I think this is not really sqlite related, i am using fastcgi with nginx
>server and when security became in issue i had similar problems
>quick solution - do 'chmod -R 777  /srv/www' and you will see if problem
>is related to rights or if its something else

Thanks a lot. It was indeed due to . being owned by "root" instead of
"lighttpd" (it would be a good thing if the RPM had created and
chowned the www directory this way). I didn't think of this because
"ll" doesn't show hidden files, unlike "ls -al"

===========
# ls -al
drwxr-xr-x 2 root root  4096 May 18 16:02 .
===========
#chown lighttpd.lighttpd ./.
===========
<?php
try {
    #$dbh = new PDO("sqlite:/srv/www/lighttpd/db.sqlite");
    $dbh = new PDO("sqlite:db.sqlite");

    $dbh->exec("CREATE TABLE IF NOT EXISTS customer (id INTEGER
PRIMARY KEY AUTOINCREMENT, name VARCHAR(255))");
    $dbh->exec("INSERT INTO customer (name) VALUES ('Dummy')"); 
    $sql="SELECT name FROM customer";
    foreach ($dbh->query($sql) as $row) {    
       print $row['name'] . "<p>\n";
    }   
    
    $dbh = null;
    }
catch(PDOException $e)
    {
    echo $e->getMessage();
    }
?>
===========

Works fine now, even with a path-less, relative filename. Thank you.

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

Reply via email to