JSON support is included in PHP version 5.2.0 and later, but if you’re running a default 5.1.x stack (like most CentOS systems, since it’s in the default repositories), you can get JSON support for your PHP 5.1 like this.
1. Via yum (CentOS 5.x)
[root@srv src] yum install php-pecl-json
2. Via PECL (CentOS 4.x)
Update your PHP.NET channel.
[root@srv src]# pecl channel-update pecl.php.net Retrieving channel.xml from remote server Channel pecl.php.net channel.xml is up to date
Search for the package.
[root@srv src]# pecl search json Retrieving data...0%....50%....Matched packages, channel pecl.php.net: ======================================= Package Stable/(Latest) Local json 1.2.1/(1.2.1 stable) JavaScript Object Notation. Note: This extension is now part of PHP Core, so use it instead. As of PHP 5.2.0.
And install it.
[root@srv src]# pecl install json downloading json-1.2.1.tgz ... Starting to download json-1.2.1.tgz (17,780 bytes) ......done: 17,780 bytes 11 source files, building ...
Have fun!