php-uv icon indicating copy to clipboard operation
php-uv copied to clipboard

[ANN] cares removed.

Open chobie opened this issue 13 years ago • 8 comments

https://github.com/joyent/libuv/issues/518

https://github.com/chobie/php-uv/tree/develop

TODO: take a look into PECL ares and write how to migrate bundled functions.

chobie avatar Sep 15 '12 19:09 chobie

Or maybe port this https://code.google.com/p/netdns2/source/browse/trunk/Net/DNS2.php to use php-uv?

xming avatar Mar 27 '13 20:03 xming

@xming for userland DNS take a look at react/dns. We're in the process of integrating the libuv loop so that they can be composed.

I would really like to see an updated version of the ares pecl extension though. I couldn't get the current one to work properly.

igorw avatar Mar 27 '13 21:03 igorw

It works for me. I am using

  • Gentoo Linux
  • c-ares 1.7.4
  • php 5.4.13

How to:

  • get http://pecl.php.net/get/ares-0.7.0.tgz then patch with https://bugs.php.net/patch-display.php?bug=63131&patch=pecl_ares_osx_support.patch&revision=1348236238
  • phpize
  • aclocal
  • libtoolize --force
  • autoheader
  • autoconf
  • ./configure
  • make
<?php
$a = ares_init();
function cb()
{
        $argv = func_get_args();
        print_r($argv);
}
ares_gethostbyname($a, "cb", "google.com");
ares_gethostbyaddr($a, "cb", "8.8.8.8");

ares_process_all($a);
ares_destroy($a);

produces

Array
(
    [0] => Resource id #6
    [1] => 0
    [2] => stdClass Object
        (
            [name] => google-public-dns-a.google.com
            [aliases] => Array
                (
                    [0] => google-public-dns-a.google.com
                )

            [addrtype] => 2
            [addrlist] => Array
                (
                    [0] => 8.8.8.8
                )

        )

)
Array
(
    [0] => Resource id #5
    [1] => 0
    [2] => stdClass Object
        (
            [name] => google.com
            [aliases] => Array
                (
                )

            [addrtype] => 2
            [addrlist] => Array
                (
                    [0] => 74.125.136.113
                    [1] => 74.125.136.102
                    [2] => 74.125.136.100
                    [3] => 74.125.136.138
                    [4] => 74.125.136.101
                    [5] => 74.125.136.139
                )

        )

)

Any ideas how I can make custom queries? MX. SOA, TXT, ....

xming avatar Mar 28 '13 13:03 xming

Ah got it

ares_search($a, "cb", "google.com", ARES_T_MX);
ares_search($a, "cb", "google.com", ARES_T_SOA);

xming avatar Mar 28 '13 13:03 xming

Cool, I was probably missing the OSX support.

igorw avatar Mar 28 '13 13:03 igorw

Isn't that patch from you? :D

xming avatar Mar 28 '13 14:03 xming

yea, I sent a patch. but some features does not work properly on my osx :cry:

chobie avatar Mar 28 '13 14:03 chobie

Such as? Maybe I can test them here on linux.

xming avatar Mar 28 '13 15:03 xming