![]() |
Cron job doesn't load CI_ENV config in .htaccess with CodeIgniter 3.1.9 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: Cron job doesn't load CI_ENV config in .htaccess with CodeIgniter 3.1.9 (/showthread.php?tid=72134) |
Cron job doesn't load CI_ENV config in .htaccess with CodeIgniter 3.1.9 - imabot - 11-10-2018 I'm using a Cron job with CodeIgniter. Since this is the server that run the script, the config in the .htaccess is not loaded. The problem is : # CI set environment SetEnv CI_ENV production As the .htaccess is not loaded, this is the default *development* environment that is loaded. The direct consequence is that access to DB failed. How should I properly solved this problem ? RE: Cron job doesn't load CI_ENV config in .htaccess with CodeIgniter 3.1.9 - dave friend - 11-10-2018 (11-10-2018, 12:52 AM)imabot Wrote: I'm using a Cron job with CodeIgniter. Since this is the server that run the script, the config in the .htaccess is not loaded. The problem is : What I have done is edit index.php changing PHP Code: define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development); PHP Code: define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'production'); Because "production" seems like a safer choice to make when you cannot safely determine exactly what the environment is. |