dns lookups only half working in chroot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey guys,

I am cross-posting this to the PHP and the PHP-FPM lists, because both are applicable in my opinion.

I have got a strange problem with my php-fpm chrooted PHP environment.
PHP is chrooted to /var/www/.

/var/www/etc looks like this:
# ls -al /var/www/etc/
insgesamt 20
drwxr-xr-x 2 root root 4096  9. Sep 20:33 .
drwxr-xr-x 5 root root 4096  9. Sep 20:10 ..
-rw-r--r-- 1 root root  265  9. Sep 20:12 hosts
-rw-r--r-- 1 root root  513  9. Sep 20:23 nsswitch.conf
-rw-r--r-- 1 root root   52  9. Sep 20:11 resolv.conf

I do run the following script:
<?php
echo gethostbyname('www.google.de')."\n";
print_r(dns_get_record('www.google.de', DNS_A))."\n";
?>

Which strangely outputs this:
www.google.de
Array
(
    [0] => Array
        (
            [host] => www.l.google.com
            [type] => A
            [ip] => 74.125.43.147
            [class] => IN
            [ttl] => 172
        )

    [1] => Array
        (
            [host] => www.l.google.com
            [type] => A
            [ip] => 74.125.43.99
            [class] => IN
            [ttl] => 172
        )

    [2] => ....

I don't understand why the first lookup fails, but the second one succeeds.
Unfortunately thinks like fsockopen() seem to use the same technique as gethostbyname(), so they don't work either.
Any pointers would be appreciated!

Regards,
Samy

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux