Skip to content

Conversation

@yceruto
Copy link
Member

@yceruto yceruto commented Aug 30, 2017

Setting DATABASE_URL=sqlite:///var/data/blog.sqlite as default, causes this known error through index.php:

An exception occurred in driver: SQLSTATE[HY000] [14] unable to open database file

So the right relative path in this case should be sqlite:///../var/data/blog.sqlite BUT then it wouldn't work for bin/console entries. Then, relative paths shouldn't be the right way but absolute paths.

The right thing is that soon (in 3.4 & 4.0) we can use environment variables with configuration parameters symfony/symfony#23901, so the final configuration would be the one proposed. For now a workaround to make both scenarios work index.php and bin/console.

@javiereguiluz
Copy link
Member

Thanks for fixing this issue and for the perfect explanation!

@javiereguiluz javiereguiluz merged commit e45b5d5 into symfony:master Aug 30, 2017
javiereguiluz added a commit that referenced this pull request Aug 30, 2017
…ameter (yceruto)

This PR was merged into the master branch.

Discussion
----------

Workaround to use DATABASE_URL with %kernel.project_dir% parameter

Setting `DATABASE_URL=sqlite:///var/data/blog.sqlite` as default, causes this known error through `index.php`:
```
An exception occurred in driver: SQLSTATE[HY000] [14] unable to open database file
```
So the right relative path in this case should be `sqlite:///../var/data/blog.sqlite` BUT then it wouldn't work for `bin/console` entries. Then, relative paths shouldn't be the right way but absolute paths.

The right thing is that soon (in 3.4 & 4.0) we can use environment variables with configuration parameters symfony/symfony#23901, so the final configuration would be the one proposed. For now a workaround to make both scenarios work `index.php` and `bin/console`.

Commits
-------

e45b5d5 Workaround to use DATABASE_URL with %kernel.project_dir% parameter
@yceruto yceruto deleted the database_error branch August 30, 2017 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants