Wordpress Error establishing DB if using "localhost"

I would expect this has to do with process isolation and filesystem / socket access.

the jail will prevent the daemons running as it’s own user from accessing certain sockets, like the mysql database socket. or the hosts file to resolve things like the hostname “localhost”

there may also be some things needed from things like /proc /sys /tmp and /dev
I wonder if in the error logs you can see things like access denied when you check for the errors in WordPress. might give a hint as to what resource is denied access. at the same time check the error logs for the global default websites, and the logs in /var/log/messages /var/log/secure.

1 Like

As a bit more explanation:

mysql used as localhost will connect via the actual file socket configured in the mysql server config. that action is denied by jailkit.

adding the path to the socket via say a mount --bind link into the jail causes risks as actually deleting the socket… can cause trouble. when one uses 127.0.0.1, it uses a tcp network socket, which is allowed and as a result the connection works.

the same goes for certain php-fpm options, if they use filesystem based sockets… jailkit acts up. run the worker pool on a TCP-listen port ( use the IP not the domain name localhost ) things start to work again.

As in the loopback test localhost is used by wordpress, the loopback test fails ( as wordpress is aware of ipv4 vs ipv6, and localhost working on both as resolved by the system itself then seems the proper way ) jailkit does act up.

2 Likes

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.