Can't get php+sqlite working
- by facha
Hi, everyone
I'm struggling all morning to make php work with an sqlite database. Here is a piece of php code that I try to execute:
#less /var/www/html/test.php
<?php
$db=new PDO("sqlite:/var/www/test.sql");
$sql = "insert into test (login,pass) values ('login','pass');";
$db->exec($sql);
?>
Here is how I've done tests:
# sqlite3 /var/www/test.sql
sqlite> create table test (login varchar,pass varchar);
#chown apache:apache /var/www/test.sql
#chmod 644 /var/www/test.sql
Here is the stuff that drives me mad:
When I execute from command line:
#php test.php
everything goes well. Sql is being executed and I can see a new row appear in the database.
When I execute the same script from a browser - sql is not being executed. I don't get a new row in the database. There are no errors in the apache log file.
Please, help