dns lookups only half working in chroot

From: Date: Wed, 09 Sep 2009 18:54:13 +0000
Subject: dns lookups only half working in chroot
Groups: php.general 
Request: Send a blank email to php-general+get-297840@lists.php.net to get a copy of this message
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

« previous php.general (#297840) next »