Welcome! Log In Create A New Profile

Advanced

Chroot and resolv.conf

Posted by Andrew Kane 
Andrew Kane
Chroot and resolv.conf
June 09, 2010 09:48PM
Hi,

I am trying to get this piece of code to work on my server (nginx +
php 5.3).


// should return google's ip
// returns "www.google.com" on failure
$ip = gethostbyname("www.google.com");
echo $ip;


However, it does not work due to chroot. I copied /etc/resolv.conf
into $PATH_TO_CHROOT/etc/resolv.conf, but haven't had any luck. This
issue is discussed on the Russian group (http://groups.google.com/
group/highload-php-ru/browse_thread/thread/d956718f0d4400fa), but I
wasn't able to understand the resolution. If someone could help me
out, it'd be greatly appreciated.

--Andrew
Jérôme Loyet
Re: Chroot and resolv.conf
June 10, 2010 02:08AM
2010/6/10 Andrew Kane <acekane1@gmail.com>:
> Hi,
>
> I am trying to get this piece of code to work on my server (nginx +
> php 5.3).
>
>
> // should return google's ip
> // returns "www.google.com" on failure
> $ip = gethostbyname("www.google.com");
> echo $ip;
>
>
> However, it does not work due to chroot.  I copied /etc/resolv.conf
> into $PATH_TO_CHROOT/etc/resolv.conf, but haven't had any luck.  This
> issue is discussed on the Russian group (http://groups.google.com/
> group/highload-php-ru/browse_thread/thread/d956718f0d4400fa), but I
> wasn't able to understand the resolution.  If someone could help me
> out, it'd be greatly appreciated.

Hi,

what is the content of you resolv.conf ?
Evgeny Petrenko
Re: Chroot and resolv.conf
June 10, 2010 02:44AM
Hello, Andrew

You have to put next files from the host system into chroot dir:

/ets/resolv.conf
/etc/nssswitch.conf
/lib/libnss_dns.so

With these files all should work fine.

2010/6/10 Andrew Kane <acekane1@gmail.com>:
> Hi,
>
> I am trying to get this piece of code to work on my server (nginx +
> php 5.3).
>
>
> // should return google's ip
> // returns "www.google.com" on failure
> $ip = gethostbyname("www.google.com");
> echo $ip;
>
>
> However, it does not work due to chroot.  I copied /etc/resolv.conf
> into $PATH_TO_CHROOT/etc/resolv.conf, but haven't had any luck.  This
> issue is discussed on the Russian group (http://groups.google.com/
> group/highload-php-ru/browse_thread/thread/d956718f0d4400fa), but I
> wasn't able to understand the resolution.  If someone could help me
> out, it'd be greatly appreciated.
>
> --Andrew



--
With best regards, Evgeniy Petrenko.
Andrew Kane
Re: Chroot and resolv.conf
June 11, 2010 07:42PM
Thanks for the quick responses. I'll post when I get a chance to try
it.

On Jun 10, 2:43 am, Evgeny Petrenko <guest...@gmail.com> wrote:
> Hello, Andrew
>
> You have to put next files from the host system into chroot dir:
>
> /ets/resolv.conf
> /etc/nssswitch.conf
> /lib/libnss_dns.so
>
> With these files all should work fine.
>
> 2010/6/10 Andrew Kane <aceka...@gmail.com>:
>
>
>
>
>
> > Hi,
>
> > I am trying to get this piece of code to work on my server (nginx +
> > php 5.3).
>
> > // should return google's ip
> > // returns "www.google.com" on failure
> > $ip = gethostbyname("www.google.com");
> > echo $ip;
>
> > However, it does not work due to chroot.  I copied /etc/resolv.conf
> > into $PATH_TO_CHROOT/etc/resolv.conf, but haven't had any luck.  This
> > issue is discussed on the Russian group (http://groups.google.com/
> > group/highload-php-ru/browse_thread/thread/d956718f0d4400fa), but I
> > wasn't able to understand the resolution.  If someone could help me
> > out, it'd be greatly appreciated.
>
> > --Andrew
>
> --
> With best regards, Evgeniy Petrenko.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 132
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready