Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Ubuntu, with PHP5-FPM, mysql & Nginx

I've just setup a chrooted jail with jailkit. Now I need to work out how to setup my php and mysql to work within the jail.

Google search doesn't give me much, and there's no documentation for this on the jailkit website. (It may be easy but I'm fairly new to this field)

share|improve this question

Here is a sample configuration section that you can put in /etc/jailkit/jk_init.ini so that future jail adds are seamless.

I used this section

comment = mysql client
executables = /usr/bin/mysql
paths = /usr/lib/ , /usr/lib/, /usr/lib/,/usr/lib/,/lib/

Seemed to work well, you may need to change some paths. jailkit MAY resolve the symlink paths on its own but i added both in case.

Two caveats

1) Users must use full mysql -h syntax (mysql -h basehostname database) since you do not have the mysql local sockets in the jail

2) Your mysql must be listening on the public interface so the jail can connect to it.

share|improve this answer
up vote 1 down vote accepted

Figured it out anyhow!

Just find out where the php & mysql binaries reside (/user/bin or /user/sbin) and copy them to the relative chroot directory. Then when you run the php command from the chroot user you'll get an error saying such and such a libary is missing so then you've just got to find that libaray and copy it into the relative chroot directory and keep going like that until all the dependant libraries have been copied over.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.