Welcome Guest, Not a member yet? Register   Sign In
Environment affecting the configuration files in CLI mode
#4

(07-17-2018, 12:02 AM)kaitenz Wrote: It always point to my 'development' database configuration. That's why I'm getting that error. Meaning to say that "SetEnv CI_ENV" is not working on .htaccess if you use CLI.

That's right, because .htaccess is Apache webserver related and is only used if you access php files via browser or API remotely. Cron job is local process where you tell php library to run a specific script and so .htaccess is completely out of the mix.

(07-17-2018, 12:02 AM)kaitenz Wrote: So my alternative way is to manually change the index.php where ENVIRONMENT constant is defined.

Hardcoding is quick and dirty fix, but it might bite you when you need to re-build servers or add more test servers or work with more people who have their local dev environments, so environmental variables / DotEnv are better option in that sense.

(07-17-2018, 12:02 AM)kaitenz Wrote: Or another alternative (I don't know if this will work) to SetEnv is DotEnv. I don't know how I can make this work but let's give it a try.

Yep, that should work, as long as your CLI and normal web-side settings are the same.
Reply


Messages In This Thread
RE: Environment affecting the configuration files in CLI mode - by Pertti - 07-17-2018, 12:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB