Issues with Laravel Sqlite File Permission

Asked

Viewed 201 times

0

I’m having problem with initializing the Sqlite database when I run the command migrate error appears like this

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

My file .sqlite is located in the Storage folder and its name is database.sqlite.

In my configuration file it looks like this:

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

I don’t know what’s going on.

MY OPERATING SYSTEM IS WINDOWS

  • Is your environment windows or linux? If it’s linux try checking the sqlite file permissions.

  • my environment is windows

  • @Renanrodrigues tries to put two instead of /, only as a test.

  • @Wallacemaxters still yes it didn’t work

  • @Renanrodrigues make a test. Type php artisan tinker in the folder of the terminal, by the command line. When you open Tinker, type file_exists(storage_path().'/database.sqlite') to test if the file really exists. If it exists, test with is_writable or is_readable.

  • both tests gave as true

  • @Renanrodrigues now do another test. Put all these above codes inside a file public/temp.php. And access temp.php in its url. The way apache reads permissions may be different (of course, if Windows has the same permission issues as Linux). If this is the case (and if possible), delete the file and create another one, to see if it solves the situation.

  • What has to be the return ? Because he showed me on the screen the 3 commands

  • I created the file with touch, is that why ?

  • decobri, was missing a sqlite drive in my ide, do not know why kkkk

  • I lie I think not kkk

  • It really didn’t work

  • The file is in the folder app/storage/ or in a subfolder?

  • @Guilhermenascimento is in app/Storage folder

  • @Renanrodrigues this storage_path('database.sqlite') didn’t work, did it? If you put this in a controller return storage_path('database.sqlite'); and point to a route, which Laravel prints?

  • only minute to test

  • The path of my file to the right, actually I think the problem is with permission, however I tried to give permission by windows and it does not work, and I used commands and also nothing happens

Show 12 more comments

1 answer

1

The solution was very simple and to achieve it alone. The page where my server was had an accent on the is, so when I had to access the system did not work, because the accent is replaced by another character.

As a long-time programmer falls for this nonsense, there is a tip for everyone to be careful with the name we give to projects.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.