0

I am using CakePHP and was trying to implement https://github.com/josegonzalez/cakephp-environments

Which seemed to be going fine except that I have no idea where to specify the env specific database info.

Does anyone know where to set these?

itamar
  • 3,837
  • 5
  • 35
  • 60

1 Answers1

0

I personally haven't used the plugin, however from looking at the code and the docs, if you were using the suggested database configuration, then it seems that you would define the options as either environment variables, which can be done in various ways, for example

  • in your server configuration (Apache example)
  • in your cloud varibale settings (Heroku example)
  • manually using putenv(), $_ENV, $_SERVER

    $name = 'MYSQL_DB_HOST';
    $value = 'localhost';
    
    putenv("$name=$value");
    $_ENV[$name] = $value;
    $_SERVER[$name] = $value;
    
  • ...

or as CakePHP configuration values via the Environment::configure() calls, something like:

Environment::configure('development',
    true,
    array(
        'MYSQL_DB_HOST' => 'localhost',
        'MYSQL_USERNAME' => 'user',
        // ...
    ),
    // ...
);
Community
  • 1
  • 1
ndm
  • 59,784
  • 9
  • 71
  • 110