samihsoylu / journal

Journal is a privacy first, self hosted digital log book. It is designed to be accessible anywhere you go, allowing you to organize your thoughts, feelings and opinions in one place.
GNU General Public License v3.0
66 stars 5 forks source link

Database migration cant find database variables #23

Closed ekremparlak closed 2 years ago

ekremparlak commented 2 years ago

When i try to migrate, database migration tool can't find DB_HOST and other variables

root@e975db9c0f67:/var/www/html# vendor/bin/doctrine-migrations migrate --no-interaction

Notice: Undefined index: DB_HOST in /var/www/html/private/lib/Database/Database.php on line 24

Notice: Undefined index: DB_USERNAME in /var/www/html/private/lib/Database/Database.php on line 25

Notice: Undefined index: DB_PASSWORD in /var/www/html/private/lib/Database/Database.php on line 26

Notice: Undefined index: DB_SCHEMA in /var/www/html/private/lib/Database/Database.php on line 27
<h2>Error establishing a database connection</h2><pre>An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory</pre>

Output of .env file:

root@e975db9c0f67:/var/www/html# cat .env
DEBUG_MODE = "true"
USE_SSL = "false"
BASE_URL = "/"
DB_HOST = "mariadb"
DB_SCHEMA = "test"
DB_USERNAME = "test"
DB_PASSWORD = "test"
SITE_TITLE = "Journal"
ADMIN_EMAIL_ADDRESS = "mail@example.com"

Output of echo $DB_HOST

root@e975db9c0f67:/var/www/html# echo $DB_HOST
mariadb

When i change https://github.com/samihsoylu/journal/blob/5f55ee2b19e053070667d26a725408cfb33f0fee/private/lib/Database/Database.php#L24-L27 these lines manually to something like 'host' => mariadb, it works

BTW i can successfully connect to web page even without any change.

samihsoylu commented 2 years ago

Hi @ekremparlak

Sorry that you're experiencing this, I have run some tests from my end and I am unable to reproduce this.

Could you tell me a little bit about your hosting provider? Is this a VPS that you have set-up yourself, and if so how did you do this?

I can also provide assistance to you through Discord if you are interested. You can add me, my username is: Samih#1243.

samihsoylu commented 2 years ago

After diving into it with you via Discord, it is clear to me that this issue occurs because you're making an attempt to integrate the project with Docker.

Journal currently does not support docker. This is something I might look into in the future, but any issues related to integrating with Docker, I won't be able to provide support for right now.

samihsoylu commented 2 years ago

For anyone in the future that encounters this issue, after some debugging @ekremparlak discovered that his php ini must be configured to:

variables_order = "EGPCS" 

Read more about that here: http://php.net/variables-order