PHP-1009: JSON is optional at buildtime but requires at runtime

If you compile PHP with --enable-json=shared you'll HAVE_JSON
However, if you don't have extension=json in your PHP.ini.. HAVE_JSON
will still pretend to be there, and we eventually hit
Symbol not found: _php_json_encode

When built against json we need to require it to be loaded.
When we don't build against json, we report it normally as optional
Although, if you then compile and install json.. we won't actually know that
as we'll still think HAVE_JSON is 0 :]
There doesn't seem to be a real solution for this in PHP :/
Merge pull request #614 from bjori/PHP-1011-json-req-or-optional

PHP-1009: JSON is optional at buildtime but requires at runtime

* bjori/PHP-1011-json-req-or-optional:
  PHP-1009: JSON is optional at buildtime but requires at runtime
Fixed PHP-1013: Read preferences are not respected with command cursors.
Fixed a broken test with a hardcoded port.
Tidy up test cases a little.
Merged pull request #616