Use of undefined constant JSON_INVALID_UTF8_SUBSTITUTE - assumed 'JSON_INVALID_UTF8_SUBSTITUTE'

后端 未结 2 1769
忘了有多久
忘了有多久 2021-01-11 12:41

I recently cloned a laravel project and after running composer install, I am getting this error

In LogManager.php line 416:

Use of undefined constant JSON_I         


        
相关标签:
2条回答
  • 2021-01-11 13:41

    You should upgrade your php version to 7.2+. If that is not possible, here is a fix that i used. Just add this to your index.php file:

    if (!defined('JSON_INVALID_UTF8_SUBSTITUTE')) {
        //PHP < 7.2 Define it as 0 so it does nothing
        define('JSON_INVALID_UTF8_SUBSTITUTE', 0);
    }
    
    0 讨论(0)
  • 2021-01-11 13:47

    Possibly you use higher version of php CLI you use to run composer install on command line, than php version on Webserver configuration (this occasionally happen).

    You just need to set the webserver configuration to use the same php CLI version you use on command line.

    0 讨论(0)
提交回复
热议问题