Kiran Kumar Kiran Kumar - 3 months ago 46
JSON Question

PHP's json extension is required to use Monolog's NormalizerFormatter

I'am new to symfony. I have created symfony project using:
symfony new PhpSymfony // command.
when i run project using:
php bin/console server:run // command, app.php page is displayed in the browser (http://localhost:8000).
But if I run without using the command php bin/console server:run,
I will get an exception in the browser

"RuntimeException in classes.php line 5493: PHP's json extension is required to use Monolog's NormalizerFormatter"

I am running on http://localhost/app_dev.php
and I a using apache2 server...
How to solve this problem ?

Answer

You need to install PHP and required PHP extensions.

Install PHP JSON extension for *nix/Linux:

sudo apt-get install php5-json

Depending of Symfony version, you need to enable list of extensions (for Symfony 2.8.*):

  1. PHP needs to be a minimum version of PHP 5.3.9.
  2. JSON needs to be enabled.
  3. ctype needs to be enabled.
  4. Your php.ini needs to have the date.timezone setting.

Requirements for Running Symfony

Also, you need to set up Web-server.

More information about setting up Symfony project here.