I am puzzled with one interesting problem.
In my .env laravel 5 app file setup, I have following environments variable(clearly this is for production setup with mysql which I am overriding in my docker run command) in my container by passing the different names for sqlite)
DB_CONNECTION=mysql
DB_HOST=database
DB_PORT=3306
DB_DATABASE=homestead
Here is my config/database.php :
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('my-sqllite-db.sqlite')),
'prefix' => '',
],
I am using sqlite on my docker based local php-fpm and nginx (multiservice) container. I build the docker image (my_app_img) and pass following environment variable to run docker container
docker run -p 80:80 --name MyApp -d -e "DB_CONNECTION=sqlite" -e "DB_DATABASE=database/my-sqllite-db.sqlite" -e "DB_HOST=127.0.0.1" my_app_img
After this when I do :
docker exec container_ID php artisan migrate
This works on on terminal and shows that it is successful to connect to sqlite file.
But when I then try to register my user on a webpage, which is supposed to now hit the sqlite db (as I have also finished my migration), I get following error :
Database (database/my-sqllite-db.sqlite) does not exist. (SQL: select count(*) as aggregate from "users" where "name" = "Andrew:
Anyone has any insight into why the php artisan was able to use the sqlite connection properly but webpage is not able to use this connection?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire