unable to connect to sqlite3 database file with PHP
unable to connect to sqlite3 database file with PHP
I just downloaded the latest version of editor and am trying to connect to a sqlite3 database file with PHP.
In my php/config.php file:
$sql_details = array(
"type" => "Sqlite",
"user" => "",
"pass" => "",
"host" => "",
"port" => "",
"db" => "/var/www/prod/test.db",
"dsn" => "",
);
The permissions on this file are 666.
Error message I get when I load my HTML file (tablename=datatest):
DataTables warning: table id=datatest - An error occurred while connecting to the database '/var/www/prod/test.db'.
The error reported by the server was: SQLSTATE[HY000] [14] unable to open database file
What might I be doing wrong?
Thanks,
-John
This discussion has been closed.
Answers
That'll be a problem with the DB itself, not the
config.php
file. This site should help - it gives some clues on what to do,Colin
Colin,
I created a 'data' directory with 777 permissions and placed the .db file in it with 666 permissions. I am still getting the same error message.
How can I debug this? It looks like the source code is 'minimized' so it is not possible to step through it to determine how the file is being opened.
Thanks,
-John
It's going to be a permission problem still - probably something like the webserver user is unable to access that directory. The server-side source code isn't minimised, so you could add debug into the PHP script, or knock out a similar PHP script that tries to access the DB. Also check the groups as in that link I posted. And if still no joy, it would be worth checking the error on StackOverflow, as a fair few threads discussing it there with solutions,
Colin