When I enable Chroot PHP-FPM on websites, they stop working with the message "Error establishing a database connection". I am not sure where to look for and what to do? Any thoughts?
Try to create etc/hosts file in your chroot directory with content: Code: 127.0.0.1 localhost and make sure you have in your web app "localhost" as mysql server address / hostname
I am not a Linux expert, so please bear with me. What do you mean by "create etc/hosts file in your chroot directory"?
Go to website root directory: Code: cd /var/www/clients/clientX/webY create an "etc" directory Code: mkdir etc create a file name "hosts" in "etc" directory Code: nano etc/hosts with content Code: 127.0.0.1 localhost For sure, change permissions of that file: Code: chmod 644 etc/hosts
Thank you! I tried the changes you suggested, but ended up with the same error - "Error establishing a database connection". Other ideas or changes that I should do to fix this?
show output from Code: ls -la /var/www/clients/clientX/webY ls -la /var/www/clients/clientX/webY/etc cat /var/www/clients/clientX/webY/etc/hosts what hostname do you have configured in your web app for mysql server? what are the allowed hosts for mysql user you are using?
Please see the attached screenshots. The applications are all wordpress websites and have 'localhost' configured in the db_host field. mysql bind address is set to 127.0.0.1 - default from the installation.
You can try this: 1) Delete the etc foilder that you've added. it is owned by a wrong user. 2) Now add a shell user in ispconfig and choose to add it as jailed shell user, this will setup a jail environment inside the website directory.
And in the WordPress config file, use "127.0.0.1" as database host and not 'localhost'. using localhost will cause PHP to try to connect through the socket file instead of using a network connection.
Yes, I noticed that too and so created a new jailed shell user, but cannot chroot into it. Did I mess up setting the jailkit setup? Code: chroot /var/www/clients/client269/web14491/ chroot: failed to run command ‘/bin/bash’: No such file or directory In regards to changing the wp-config.php file. if I change the db_host to 127.0.0.1, the site title shows but nothing else. The webpages never come up. Thoughts??
Did you remove the etc folder upfront? if not, the jail creation probably failed due to a security violation. That's good as it basically means the database connection issue is fixed. Check the website error.log to see if there are further errors.
Hmm... the error logs have the following message. Should I change the permissions to usr/share/zoneinfo and etc/localtime? or do something else? "AH01071: Got error 'PHP message: PHP Fatal error: strtotime(): Timezone database is corrupt - this should *never* happen! in /web/wp-includes/functions.php on line 35\n'" Also, I created a new website under the new jailed user, but don't see an 'etc' folder underneath it. ;-(
That does not look like a permission problem. The process seems to be able to read the timezone database, but it is broken somehow. Put that error message to Internet Search Engine to find how to repair that corruption.