Apach2 mod_ruid2 and RDocumentChRoot & mdash; Unable to connect to the MySQL database


In Apache2 virtualhost, I've got mod_ruid2 working as I want using RMode stat. I added RDocumentChRoot to chroot the process to the website folder and an unwanted side-effect is that PHP can't connect to the MySQL database. I googled for help and couldn't find anything.

Can anyone throw me some rope?

Thanks to Mario for mentioning the "mysql socket thingy". After some searching around, I found out MySQLD uses a file called mysqld.sock as an optional way to receive connections. Running 'locate *.sock' on your system will show you .sock files. dkim-filter also uses a .sock file. According to another website I read, socket files are FIFO files created by applications and they do nothing more than act as a redirectional pipe to allow applications to communicate with each other without having to go through other socket configuration stuff.

In the case I asked about, a chrooted php process can't access the .sock file since its outside the chroot. Fortunately, I deduced that PHP uses the .sock file because of a connection variable. In WordPress, the default configuration uses 'localhost'. A 'localhost' specification in PHP will cause PHP to look for the .sock file instead of doing a network connection. Changing 'localhost' to '' fixed the problem gracefully. No hardlinks or other workarounds were needed.