My PHP version is 5.1.6 I have install Json by follow the instructions:
# yum install php-devel
# yum install php-pear
# yum install gcc
# pear install json
From Let's Install JSON for PHP 5
Install json - This was actually trickier than expected. I assumed I would be able to install this via
pear
. Apparently, a PEAR Services_JSON package was developed, but it has never been accepted into the official repository. The trick instead is to use the PECL json package. This was as easy as runningpecl install json
and watching the compiler do its thing. When it's done you should have ajson.so
file in your PHP modules directory. (Mine is/usr/lib/php/modules/
.)
If your var_dump( function_exists( 'json_encode' ) )
returns true, while your HTTP request says the function doesn't exist; there's only one explanation I can think of: CLI and HTTP requests use a different php.ini. In your phpinfo( )
document, it says that it's loading json.ini, but I don't see any other reference to JSON in there.
Check your logs to see whether or not json.so is actually loaded upon a HTTP request. My bet is that it isn't.
Granted, this is an old topic, but maybe someone will stumble across this like I did in August 2015. I fixed this by changing the extensions folder path in php.ini. It was somehow set to "./" and not /usr/lib64/php/modules/