Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Jul 8 18:57:04 UTC 2015

On Wed 2015-07-08 14:32:40 -0400, Hollenbeck, Scott wrote:
> Here's my use case:
> PHP extensions can publish information that is made available to
> clients who call the phpinfo() function. It's typically used to
> publish version numbers, information about dependencies, and the
> like. Here's what my PHP extension currently publishes:
> "getdns
> GetDNS Support => enabled
> Extension Version => 0.7.2
> getdns Library Version => getdns 0.2.0 configured on 2015-05-21T12:51:51Z for the January 2015 version of the API
> Author => Scott Hollenbeck <shollenbeck at verisign.com>"
> I currently get the "getdns Library Version" information using
> GETDNS_COMPILATION_COMMENT because it's compiled into my code and
> available when PHP loads the extension. There are no function calls
> that might break at run time if the getdns library isn't available. I
> need a value that is 100% guaranteed to be available when PHP loads
> the extension even if the getdns library is unavailable.

hm, i don't think other comparable php bindings have the same constraint
(or maybe they're buggy?).  Do you want to report "GetDNS Support =>
enabled" even if the getdns library is unavailable?

By comparison, the jsonc module produces its info output from both
compile-time and runtime information:


If i move libjson-c.so.2 out of the way (so that dlopen can't find it)
and re-run phpinfo(), i find that the php json module just doesn't load
at all, and produces nothing in phpinfo():


0 dkg at alice:~$ printf '<?php phpinfo(); ?>' | php | grep -C2 -i ^json
imagick.skip_version_check => 0 => 0


json support => enabled
json version => 1.3.6
JSON-C headers version => 0.11.99
JSON-C library version => 0.11.99

0 dkg at alice:~$ printf '<?php phpinfo(); ?>' | php | grep -C2 -i ^json
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/json.so' - libjson-c.so.2: cannot open shared object file: No such file or directory in Unknown on line 0
1 dkg at alice:~$


Should getdns be different?


More information about the Users mailing list