• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How / When / How 'env' is parsed?

#1
Dear community,

I was a CodeIgniter 3 user, and now diving into CodeIgniter 4.

I am trying to use 'env' functionality, but even if I un-comment the
line for CI_ENVIRONMENT, the variable ENVIRONMENT value still 'production' in my code.

I have tried
PHP Code:
getenv('CI_ENVIRONMENT'
but it is not defined.

To follow, I have added a variable as the documentation said, MYTEST = "value1" in the 'env' file,
and in a controller, using
PHP Code:
getenv('MYTEST'
returns undefined.

I am probably doing something wrong, thank you for your lights!

glihm
Reply

#2
Hi, have you renamed your env into .env?
Reply

#3
(02-14-2020, 11:46 PM)jreklund Wrote: Hi, have you renamed your env into .env?

... I do apologize for that. Thank you very much jreklund. Smile
Reply

#4
No need to apologize, glad it worked out for you! :-)
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.