I am trying to install a Codeigniter application in pure NGINX + PHP-FPM environment but it was previously developed in apache .
After adding all the proper rules to Nginx in order to work with Codeigniter I am being faced with this error related to my $_ENV variable .
Undefined variable: _ENV in /home/nginx/domains/mydomain.com/system/Config/BaseConfig.php ?
Here is the code calling the $_ENV variable :
case array_key_exists("{$shortPrefix}.{$property}", $_ENV):
return $_ENV["{$shortPrefix}.{$property}"];
break;
case array_key_exists("{$shortPrefix}.{$property}", $_SERVER):
return $_SERVER["{$shortPrefix}.{$property}"];
Worth mentioning I am trying to call a task by running php spark task:run tasks when the error takes place in CLI .
Things I have tried to do so far :
1) I have added a _ENV variable to my PHP-FPM this way :
env[_ENV] = production
2) I exported ENV variable in CLI :
export _ENV=production
3) I have added the following line in Nginx Config :
location / {
fastcgi_param CI_ENV production;
}
Nothing seems to work and my $_ENV or $SERVER variables always seem empty and I get the same error when I try to run my task .
Anything else I can make to debug this and setup my $_ENV variable to run properly with my app ?
Found the solution !
Changing the default of this variable in PHP.INI to off did the trick !