简体   繁体   中英

Can't find SQLite database on network in PHP

I am running my PHP file locally on a WAMP server. Right now it works if the SQLite .db file is on the WAMP server, but as soon as I reference a .db file that isn't on the WAMP server then it can't find it. I have looked everywhere and can't find a similar issue. Here is where I create the .db file:

class MyDB extends SQLite3{
    function __construct(){
        $this->open('J:/scoreboard/SQLite/production_scoreboard.db');
    }
}

$db = new MyDB();

I get a PHP error for the line that is opening the .db file.

Using the assigned letter in Windows is probably causing your problem. J: is mapped for you, but not necessarily the user that the web server is running as. It is generally advised to use this format:

$this->open('//servername/sharename/scoreboard/SQLite/production_scoreboard.db');

Of course, you still might have access issues if the web server user doesn't have rights to that share and file.

If you have permission problems, check the answers here: Is it possible to have WAMP run httpd.exe as user [myself] instead of local SYSTEM?

Apparently wamp server defaults to running as SYSTEM which is definitely NOT going to be able to access network shares.

What kind of error? It can be a couple of thinks. Are the permissions and owners of the folder / file correctly?

Are you in the scope of the Script?

You see, we need the PHP error... ;)

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