unable to connect to sqlite3 database file with PHP

unable to connect to sqlite3 database file with PHP

johnugajohnuga Posts: 16Questions: 7Answers: 0

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

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    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

  • johnugajohnuga Posts: 16Questions: 7Answers: 0

    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

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    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

This discussion has been closed.