gpt4 book ai didi

php - 添加 Symfony 应用程序时出现 JSON_ERROR

转载 作者:太空宇宙 更新时间:2023-11-03 17:23:41 25 4
gpt4 key购买 nike

我刚刚在运行 PHP 7.0.14 的 CentOS 设置上安装了 Symfony。然而,我在尝试运行 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

我在网上查过答案,并且已经尝试在 php.ini 中设置 phar.readonly = Off

最佳答案

Hassan 是对的,我错过了 json-extension。通过运行 sudo yum install php70u-json

修复它

关于php - 添加 Symfony 应用程序时出现 JSON_ERROR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43140962/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com