dongzaocheng3214
dongzaocheng3214
2014-01-27 17:24

在PHP中无法在网络上找到SQLite数据库

已采纳

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.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • dongzhang0243 dongzhang0243 7年前

    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.

    点赞 评论 复制链接分享
  • dongnachuang6635 dongnachuang6635 7年前

    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... ;)

    点赞 评论 复制链接分享

相关推荐