Cant set CI_ENVIRONMENT - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Cant set CI_ENVIRONMENT (/showthread.php?tid=76660) |
Cant set CI_ENVIRONMENT - thingNumber1 - 06-07-2020 I am trying to set my environment dynamically on .htaccess file, but I cant. This is my `.htaccess` file: Code: # Disable directory browsing But the problem is that the variable `$_SERVER['CI_ENVIRONMENT']` seems to to be rewritten to `$_SERVER['REDIRECT_CI_ENVIRONMENT']` Why is that? I know I can fix it on the index.php file with something like: PHP Code: $_SERVER['CI_ENVIRONMENT'] = $_SERVER['REDIRECT_CI_ENVIRONMENT']; But it doesn't feel good. Anybody knows a better solution? RE: Cant set CI_ENVIRONMENT - InsiteFX - 06-07-2020 In order for $_ENV to work, you need to reconfigure variables_order = "GPCSE" in your php.ini. By default, it does not include E for $_ENV, it was originally variables_order = "GPCS" So check your php.ini file and make sure it is set correctly. RE: Cant set CI_ENVIRONMENT - thingNumber1 - 06-07-2020 (06-07-2020, 12:39 PM)InsiteFX Wrote: In order for $_ENV to work, you need to reconfigure variables_order = "GPCSE" in your php.ini Thank you very much. I already added the `E`. The problem is that the variable is being generate like: $_ENV['REDIRECT_CI_ENVIRONMENT']; Instead of $_ENV['CI_ENVIRONMENT']; Note the unexpected "REDIRECT_" prefix. RE: Cant set CI_ENVIRONMENT - John_Betong - 06-07-2020 I prefer setting the .htaccess generated $_SERVER variable in index.php. RE: Cant set CI_ENVIRONMENT - thingNumber1 - 06-07-2020 (06-07-2020, 06:05 PM)John_Betong Wrote: I prefer setting the .htaccess generated $_SERVER variable in index.php. Both, $_SERVER and $_ENV are prefixed with `REDIRECT_` RE: Cant set CI_ENVIRONMENT - John_Betong - 06-08-2020 (06-07-2020, 06:10 PM)thingNumber1 Wrote:(06-07-2020, 06:05 PM)John_Betong Wrote: I prefer setting the .htaccess generated $_SERVER variable in index.php. Code: <?php // index.php |