DBMigrate not reading environment variables

Hey guys,

I am using environment variables in the app.php file to externalise the dbname,host etc… and using the env() function provided by cake to reference them. I expected that DBMigrate would read and accept these variables, but it does not seem to work. Any ideas would be appreciated?

composer versions:

"require": {
    "php": ">=5.5.9",
    "cakephp/cakephp": "~3.2",
    "mobiledetect/mobiledetectlib": "2.*",
    "cakephp/migrations": "~1.0",
    "cakephp/plugin-installer": "*",
    "zendframework/zend-soap": "^2.5"

Cheers Dave.

If you’re using environment variables, and they’re set in your server configuration file, they probably aren’t available to PHP in the shell. You’ll need to export them to your bash profile to use them with Cake’s console, or use something like josegonzalez’s dotenv.

I usually just edit ~/.profile by adding something like:

export DATABASE_URL={{database URI here}}