简体   繁体   中英

Access sqlite database file in a remote server with PHP

Is it possible to access a sqlite database file in a remote server with PHP? I have enabled read access on the databse.db file and tried this:

$dbconn = new SQLite3("http://www.foo.com/database.db");

but it doesn't work:

Fatal error: Uncaught exception 'Exception' with message 'Unable to open database: unable to open database file

SQLITE is not for this operation, but we can do a trick :) .

  1. create a RESTful server-api that can be put in the remote server to control what you need.
  2. create a RESTful client-api that can be the client you use to connect with the remote RESTful server .

NOTE: this is just for fun as by this trick we created server/client api to simulate server/client db using your programming lang and sqlite :)

I think you can't connect like this. You can't open the sqlite database which is hosted on remote server, because you may need the update permission of that file.

So you can download that file in your server parametrically then can connect that file which you downloaded.

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM