jeudi 18 juin 2015

Error accessing an SQLite db from a different location using PHP

I'm stuck with this problem. I'm trying to access an sqlite database from a different location. So far I have tried using PDO to access such file. I've tried using PDO since from what I read here on SO that would be easier. I only want to do some select queries on the database.

 try{
  $DBH = new PDO("sqlite:192.168.48.52/data/log/localdb.db");
  echo "connected";
   }
  catch(PDOException $e) {
    echo $e->getMessage();
   }

it outputs an error message saying 'SQLSTATE[HY000] [14] unable to open database file'. I could access the location via SSH/putty or manually input the directory through a web browser. But not through PHP coded location. The file resides actually in a gsm gateway interface which has a -rw-r--r-- permission.

If I were to actually download the file and put it in my htdocs folder it does open the file and echos 'connected'

$DBH = new PDO("sqlite:localdb.db"); <--- **like this**

I also tried doing this since it requires some authentication to access the directory.

$DBH = new PDO("sqlite:admin:admin@192.168.48.52/data/log/localdb.db");

to no avail. Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire