Cron job doesn't load CI_ENV config in .htaccess with CodeIgniter 3.1.9 |
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 ?
(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. |
Welcome Guest, Not a member yet? Register Sign In |