Here’s a way to add JSON support for PHP on your CentOS server.
yum install php-pear php-devel gcc make
pecl install json
cd /etc/php.d
echo "extension=json.so" >> json.ini
service httpd restart
After these, you can easily check if it has been installed correctly. Either check your phpinfo() page or execute the following command.
php -i | grep -i json
/etc/php.d/json.ini,
json
json support => enabled
json version => 1.2.1