Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Uncaught ConfigException: Syntax error in configuration file: file #21

Open
github-cao opened this issue Oct 15, 2024 · 1 comment

Comments

@github-cao
Copy link

github-cao commented Oct 15, 2024

By running like this, the following error occurs

docker run -d -p 8088:80 --name=my-itop \
  -e DB_HOST=172.18.0.2 \
  -e DB_NAME=itop \
  -e DB_USER=itop \
  -e DB_PASSWORD=abc \
  supervisions/itop:latest

Fatal error: Uncaught ConfigException: Syntax error in configuration file: file = /var/www/html/conf/production/config-itop.php, error = <br /> <b>Warning</b>: Undefined array key "DB_ENV_MYSQL_DATABASE" in <b>/var/www/html/core/config.class.inc.php(2099) : eval()'d code</b> on line <b>5</b><br /> <br /> <b>Warning</b>: Undefined array key "DB_ENV_MYSQL_USER" in <b>/var/www/html/core/config.class.inc.php(2099) : eval()'d code</b> on line <b>6</b><br /> <br /> <b>Warning</b>: Undefined array key "DB_ENV_MYSQL_PASSWORD" in <b>/var/www/html/core/config.class.inc.php(2099) : eval()'d code</b> on line <b>7</b><br /> in /var/www/html/core/config.class.inc.php:2119
Stack trace:
#0 /var/www/html/core/config.class.inc.php(2034): Config->Load()
#1 /var/www/html/application/utils.inc.php(990): Config->__construct()
#2 /var/www/html/sources/SessionTracker/SessionHandler.php(109): utils::GetConfig()
#3 /var/www/html/sources/Application/Helper/Session.php(38): Combodo\iTop\SessionTracker\SessionHandler::session_set_save_handler()
#4 /var/www/html/application/startup.inc.php(69): Combodo\iTop\Application\Helper\Session::Start()
#5 /var/www/html/pages/UI.php(308): require_once('/var/www/html/a...')
#6 {main} thrown in /var/www/html/core/config.class.inc.php on line 2119

Fatal error: Uncaught ConfigException: Syntax error in configuration file: file = /var/www/html/conf/production/config-itop.php, error = <br /> <b>Warning</b>: Undefined array key "DB_ENV_MYSQL_DATABASE" in <b>/var/www/html/core/config.class.inc.php(2099) : eval()'d code</b> on line <b>5</b><br /> <br /> <b>Warning</b>: Undefined array key "DB_ENV_MYSQL_USER" in <b>/var/www/html/core/config.class.inc.php(2099) : eval()'d code</b> on line <b>6</b><br /> <br /> <b>Warning</b>: Undefined array key "DB_ENV_MYSQL_PASSWORD" in <b>/var/www/html/core/config.class.inc.php(2099) : eval()'d code</b> on line <b>7</b><br /> in /var/www/html/core/config.class.inc.php:2119
Stack trace:
#0 /var/www/html/core/config.class.inc.php(2034): Config->Load()
#1 /var/www/html/application/utils.inc.php(990): Config->__construct()
#2 /var/www/html/core/log.class.inc.php(965): utils::GetConfig()
#3 /var/www/html/core/log.class.inc.php(856): LogAPI::GetConfig()
#4 /var/www/html/core/log.class.inc.php(844): LogAPI::GetLogConfig()
#5 /var/www/html/core/log.class.inc.php(800): LogAPI::GetMinLogLevel()
#6 /var/www/html/core/log.class.inc.php(778): LogAPI::IsLogLevelEnabled()
#7 /var/www/html/core/log.class.inc.php(763): LogAPI::WriteLog()
#8 /var/www/html/core/log.class.inc.php(720): LogAPI::Log()
#9 /var/www/html/application/startup.inc.php(56): LogAPI::Error()
#10 [internal function]: {closure}()
#11 {main} thrown in /var/www/html/core/config.class.inc.php on line 2119

@Hipska
Copy link
Member

Hipska commented Oct 15, 2024

Hi, first of all, you need to run the setup first in order to get started with iTop.
Secondly, if you want to get these variables filled in without linking to a DB container, you need to adapt the environment variables to be named like this: DB_ENV_MYSQL_DATABASE.

See details:

$MySettings = array(
'db_host' => $_ENV['DB_HOSTNAME'],
'db_name' => $_ENV['DB_ENV_MYSQL_DATABASE'],
'db_user' => $_ENV['DB_ENV_MYSQL_USER'],
'db_pwd' => $_ENV['DB_ENV_MYSQL_PASSWORD'],
'db_subname' => $_ENV['DB_PREFIX'],
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants