dsuikgi9199 2015-05-21 19:20
浏览 162

SQLite无法打开数据库文件:Laravel + Windows

I'm try use a sqlite database in my laravel project, in local environment for dev (Windows 8.1 with AMMPS), but when I try run a migrate:instal command, this error apeear:

[PDOException] SQLSTATE[HY000] [14] unable to open database file

My database config file (app/config/local/database.php):

<?php

return array(
    'default' => 'sqlite',

    'connections' => array(
        'sqlite' => array(
            'driver'   => 'sqlite',
            'database' => __DIR__ . '\..\..\database\production.sqlite',
            'prefix'   => '',
        ),
    ),
);
  • 写回答

8条回答 默认 最新

  • duandao1931 2016-03-24 08:31
    关注

    If the permissions allow to write on the folder just create the storage folders.

    e-g, this how I fix the problem.

    in config/database.php :

    'connections' => [
    
      'sqlite' => [
          'driver'   => 'sqlite',
          'database' => storage_path('database/databaseName.sqlite'),
          'prefix'   => '',
      ],
    

    Then if you run on your terminal php artisan migrate, it returns you the [PDOException] SQLSTATE[HY000] [14] unable to open database file

    Create the path folder by your own, e-g in your terminal mkdir storage/database/databaseName.sqlite

    Make sure the permissions allow you to write, then re-run the command php artisan migrate, it returns you the success message : Migration table created successfully.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿