CodeIgniter Forums
Can't switch to production mode - 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: Can't switch to production mode (/showthread.php?tid=80759)



Can't switch to production mode - Jag81 - 12-14-2021

Hi all, 
I can't switch to production mode. I still have the CI_ENVIRONMENT variable set to development. 
I use the.env file. 
I changed the CI_ENVIRONMENT production line in the .env file (uncommented). 
I checked my .htaccess file in the public folder (just to be sure, no SetEnv here). 
It's very strange. With the CI_ENVIRONMENT production in the .env file, if I check $_ENV array, I can see CI_ENVIRONMENT still set to development.
But, if I check $_SERVER array, I can see CI_ENVIRONMENT set to production. 
If change again in development and check again the two arrays, I see $_ENV still in development and $_SERVER has been updated in development. 
Seems that the framework update only the $_SERVER array from my .env file change.
Other variables, like an API token, are updated in both arrays and I can see the variable updated using env() function.
I ran out of ideas. Any help to understand this?


RE: Can't switch to production mode - Jag81 - 12-14-2021

Solved!
I need to restart php spark serve


RE: Can't switch to production mode - InsiteFX - 12-15-2021

Any time you make any changes you do need to re-start the server.