JSON_ERROR when adding Symfony app

会有一股神秘感。 提交于 2019-12-23 02:42:20

问题


I just installed Symfony on my CentOS setup running with PHP 7.0.14. I am however having the following issue when trying to run symfony new project_name:

    PHP Notice:  Use of undefined constant JSON_ERROR_DEPTH - assumed 'JSON_ERROR_DEPTH' in phar:///usr/local/bin/symfony/vendor/guzzlehttp/guzzle/src/Utils.php on line 134
PHP Notice:  Use of undefined constant JSON_ERROR_STATE_MISMATCH - assumed 'JSON_ERROR_STATE_MISMATCH' in phar:///usr/local/bin/symfony/vendor/guzzlehttp/guzzle/src/Utils.php on line 134
PHP Notice:  Use of undefined constant JSON_ERROR_CTRL_CHAR - assumed 'JSON_ERROR_CTRL_CHAR' in phar:///usr/local/bin/symfony/vendor/guzzlehttp/guzzle/src/Utils.php on line 134
PHP Notice:  Use of undefined constant JSON_ERROR_SYNTAX - assumed 'JSON_ERROR_SYNTAX' in phar:///usr/local/bin/symfony/vendor/guzzlehttp/guzzle/src/Utils.php on line 134
PHP Notice:  Use of undefined constant JSON_ERROR_UTF8 - assumed 'JSON_ERROR_UTF8' in phar:///usr/local/bin/symfony/vendor/guzzlehttp/guzzle/src/Utils.php on line 134
PHP Fatal error:  Uncaught Error: Call to undefined function json_decode() in phar:///usr/local/bin/symfony/vendor/guzzlehttp/guzzle/src/Utils.php:142
Stack trace:
#0 phar:///usr/local/bin/symfony/vendor/guzzlehttp/guzzle/src/Message/Response.php(145): GuzzleHttp\Utils::jsonDecode('{"lts":"2.8.18"...', true, 512, 0)
#1 phar:///usr/local/bin/symfony/src/Symfony/Installer/NewCommand.php(127): GuzzleHttp\Message\Response->json()
#2 phar:///usr/local/bin/symfony/src/Symfony/Installer/NewCommand.php(65): Symfony\Installer\NewCommand->checkSymfonyVersionIsInstallable()
#3 phar:///usr/local/bin/symfony/vendor/symfony/console/Command/Command.php(259): Symfony\Installer\NewCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php(878): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 phar:///us in phar:///usr/local/bin/symfony/vendor/guzzlehttp/guzzle/src/Utils.php on line 142

I've checked around the web for answers, and have already tried setting phar.readonly = Off in php.ini


回答1:


Hassan was right, I was missing the json-extension. Fixed it by running sudo yum install php70u-json



来源:https://stackoverflow.com/questions/43140962/json-error-when-adding-symfony-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!