dongzaocheng3214 2014-01-27 17:24
浏览 42
已采纳

在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 2014-01-27 17:28
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝