1

In my Laravel (5.4) project I want to use sqlite. But when trying to access it I get an "Database does not exist" error.

In my .env file I use

DB_CONNECTION=sqlite
DB_DATABASE=database/easyresults.sqlite

I used touch database/easyresults.sqlite to create the db and successfully ran the migrations using php artisan migrate. But when accessing it using a XMLHTTPRequest, I get the error above.

After changing the path in the .env file to

DB_DATABASE=../database/easyresults.sqlite

I can acces it again, however any command line call doesn't work then.

What am I missing? Does it not work using the .env file? Do I have to use database_path('easyresults.sqlite') and put it directly into config/database.php?

Thanks a lot for your support.

0

1 Answer 1

2

If you want to have the database filename in your .env you can do database_path(env('DB_DATABASE', 'dbfilename')); in your config/database.php

then in your .env you would have DB_DATABASE=easyresults.sqlite

Sign up to request clarification or add additional context in comments.

1 Comment

Cool, this is what I think I'll use: 'database' => database_path(env('DB_DATABASE', 'database') . '.sqlite')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.