Php-fpm and chroot on linux

Hi nginx-en ml.

This is not exactly nginx issue, but lets say this is nginx related
thing.

php-fpm and chroot - It is working for me good, I haven’t tested
performance yet but there is two things what I need fix before I can
really use it.

First issue: php in chroot can’t resolve names. Even puting
/etc/resolv.conf in chroot isn’t solution.

2nd issue: mysqld socket. If I want connect to ‘localhost’ it using
unix:///var/run/mysqld.socket which is really smart and I like it (I
want use socket if I can.). it not work, because in chrooted env there
is no mysqld socket. There is any better way than mount -o bind ‘run’
dir into each chroot’s root?

Sorry for posting it on nginx list but this is best place to ask in my
opinion.

– Piotr.

2010/7/29 Piotr K. [email protected]:

Hi nginx-en ml.

This is not exactly nginx issue, but lets say this is nginx related thing.

php-fpm and chroot - It is working for me good, I haven’t tested performance
yet but there is two things what I need fix before I can really use it.

There should not be a revelant gap of perf between using and not using
chroot.

First issue: php in chroot can’t resolve names. Even puting /etc/resolv.conf
in chroot isn’t solution.

try putting also /etc/hosts and /etc/nsswitch.conf into the chroot. Is
it better ?

2nd issue: mysqld socket. If I want connect to ‘localhost’ it using
unix:///var/run/mysqld.socket which is really smart and I like it (I want
use socket if I can.). it not work, because in chrooted env there is no
mysqld socket. There is any better way than mount -o bind ‘run’ dir into
each chroot’s root?

if you have only one chrooted env, you can setup mysqld to write its
unix socket into the chroot (ex:
/path/to/chroot/var/run/mysql.socket). Then the socket will be
available from inside and from outside the chroot.

If you have more than one chrooted env, then you can’t use unix
socket. You’ll have to use TCP on localhost.

Sorry for posting it on nginx list but this is best place to ask in my
opinion.

you should continue this conversation on
http://groups.google.com/group/highload-php-en.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs