codeigniter4 / CodeIgniter4

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
5.35k stars 1.9k forks source link

Unable set ENVIRONMENT with Spark #1268

Closed uno-de-piera closed 5 years ago

uno-de-piera commented 6 years ago

The documentation says that for change the environment we have some options:

Set CI_ENVIRONMENT=<environment> from .env file
Use SetEnv CI_ENVIRONMENT <environment> from .htaccess file on Apache

I tried all options but I'm unable to change the environment on my application.

The issue appears with spark server, if I serve my application with php -S localhost: -t=public all works fine.

lonnieezell commented 6 years ago

Does not appear to be a bug. If I set it in .env file it works just fine. Tested by dd(ENVIRONMENT) within the spark file itself. Changes appeared as expected.

cijagani commented 5 years ago

@uno-de-piera you are right. @lonnieezell i am facing same issue. CI_ENVIRONMENT variable value is not changing if i set CI_ENVIRONMENT=production in .env file then Debug Toolbar is still displayed and CI_ENVIRONMENT variable value is not changing.

because of $_SERVER['CI_ENVIRONMENT'] = 'development'; defined in rewrite. php it is replacing CI_ENVIRONMENT variable value and if you remove above line in rewrite.php file then it will work.

file path : appstarter\vendor\codeigniter4\framework\system\Commands\Server\rewrite.php Line : 20

CodeIgniter 4 version 4.0.0-beta.2 Context OS : windows 8.1 webserver : apache2.4 php version : 7.2

it's working properly without SPARK means only issue appears with spark server

cijagani commented 5 years ago

screenshot https://pasteboard.co/I94mF2d.jpg

cijagani commented 5 years ago

@lonnieezell you can close this issue.