Fix JSON detection

Testing HAVE_JSON is not reliable.

PHP can be build --without-json, and json extension available from another build (ex: pecl/jsonc used in free linux distribution, debian, fedora, mageia, ...)