我刚刚在运行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
答案 0 :(得分:0)
sudo yum install php70u-json
来修复它