Call to undefined function CodeIgniter\Config\putenv() |
In production environment. I got this issue. The hosting provider had blocked the putenv() function for security reason.
Quote:Fatal error: Uncaught Error: Call to undefined function CodeIgniter\Config\putenv() in /www/wwwroot/idp/printerp_api/vendor/codeigniter4/framework/system/Config/DotEnv.php:92 Stack trace: #0 /www/wwwroot/idp/printerp_api/vendor/codeigniter4/framework/system/Config/DotEnv.php(77): CodeIgniter\Config\DotEnv->setVariable() #1 /www/wwwroot/idp/printerp_api/vendor/codeigniter4/framework/system/Config/DotEnv.php(43): CodeIgniter\Config\DotEnv->parse() #2 /www/wwwroot/idp/printerp_api/public/index.php(30): CodeIgniter\Config\DotEnv->load() #3 {main} thrown in /www/wwwroot/idp/printerp_api/vendor/codeigniter4/framework/system/Config/DotEnv.php on line 92 When i'm looking for the source of DotEnv.php, it didn't check the function exists or not. PHP Code: protected function setVariable(string $name, string $value = '') So i have to remark the 92nd line of codes.
Try to add this in app/Common.php:
PHP Code: if (! function_exists('putenv')) { |
Welcome Guest, Not a member yet? Register Sign In |