Based on my php_info() my PHP version is PHP Version 5.2.9
However, for some reason when i try and use json_decode, I receive an error that the function is not found (and it should be for PHP 5.2 and up).
PHP.net suggests I check the configure command:
‘./configure’ ‘–prefix=/usr/local/php5’ ‘–with-config-file-scan-dir=/usr/local/php5/etc’ ‘–with-apxs2=/usr/sbin/apxs’ ‘–disable-all’ ‘–enable-libxml’ ‘–with-libxml-dir=/usr/local’ ‘–enable-reflection’ ‘–disable-cli’ ‘–disable-cgi’ ‘–enable-zend-multibyte’ ‘–with-regex=php’ ‘–enable-filter’ ‘–with-pcre-regex=yes’
I don’t understand half of this, but the –disable-all may be the problem? Is there a way to use json_decode without re-building PHP?
I could find a json function, but I’d rather use the build in PHP functions that should be available to me, and am afraid there may be other functionality that i’ll want to use later as well.
Do the libraries for JSON exist whether they have been compiled or not, and can I include them directly when I want to use them?
–disable-all is indeed the problem.
If you can’t recompile, or install a “json” package from a linux packager, I would highly suggest using Zend_Json. It will automatically use json_[en|de]code if available.
http://framework.zend.com/apidoc/1.10/Zend_Json/Zend_Json.html