Most frameworks use config caching when in production mode. Not sure if this will fix it but you might want to read over this documentation.
https://codeigniter.com/user_guide/concepts/factories.html#factories-config-caching