|Using mysql socket in apache jail|
Confining apache and mysql in separate jails creates interesting problem - how to make them communicate with each other. TCP works, but is much slower than using mysql socket - some measurements show up to 10 times difference. If you add current FreebSD syncache bug that causes packet drops in TCP, this becomes much needed option.
To be able to communicati trough unix sockets both jails must have access to the same directory. For start create required directories:
Then merge those directories by using
In the both jails open upd /var/db/my.cnf and change at both [client] and [server] parts:
In apache jail also change php.ini mysql.default_socket setting from undefined to mysql.default_socket = /mysqltmp/mysql.sock - if you are using also mysqli change also the same setting there. If you are using php in mysql jail do the same there.