For our webserver, we still run php 5.1 as thats whats part of the CentOS 5 repos and since a few of our sites run on Drupal 5 and you get nothing but errors when trying to run php 5.3. Recently our webdev was trying something and found we did not have json support. He wrote his own workaround as he is just that good, but as a good sysadmin, I set out to provide json support.
First as always make sure your packages are up to date. If php-pear isnt installed, then install it. We need the pcel command to install json support.
pecl install json
Then since php is already setup to read /etc/php.d for extra configuation info, create /etc/php.d/json.ini and add
I created a simple php page that prints out php info, so I try the following to check if it worked
php info.php | grep json
json support => enabled
json version => 1.2.1
If you see the above, all is good. Then restart the webserver and check your sites.
Thanks go to Ashvin Savani – Arckid.com