php-fpm and chroot on linux.

Jérôme Loyet jerome at
Fri Jul 30 01:40:05 MSD 2010

2010/7/29 Piotr Karbowski <jabberuser at>:
> 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

> -- Piotr.
> _______________________________________________
> nginx mailing list
> nginx at

More information about the nginx mailing list