Skip to content

Commit 87cea1c

Browse files
author
Till Brehm
committed
Merge branch 'feature/5235-useIpForApsPackagesIfChrootedFpm' into 'stable-3.1'
Use 127.0.0.1 as APS db host if php_fpm_chroot, fixes #5235 See merge request ispconfig/ispconfig3!879
2 parents bad6728 + cd18454 commit 87cea1c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

interface/lib/classes/aps_guicontroller.inc.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,15 @@ public function createDatabaseForPackageInstance(&$settings, $websrv) {
249249
$settings['main_database_host'] = 'localhost';
250250
$mysql_db_remote_access = 'n';
251251
$mysql_db_remote_ips = '';
252+
253+
// If we are dealing with chrooted PHP-FPM, use a network connection instead because the MySQL socket file
254+
// does not exist within the chroot.
255+
$php_fpm_chroot = $app->db->queryOneRecord("SELECT php_fpm_chroot FROM web_domain WHERE domain_id = ?", $websrv['domain_id']);
256+
if ($php_fpm_chroot['php_fpm_chroot'] === 'y') {
257+
$settings['main_database_host'] = '127.0.0.1';
258+
$mysql_db_remote_access = 'y';
259+
$mysql_db_remote_ips = '127.0.0.1';
260+
}
252261
} else {
253262
//* get the default database server of the client
254263
$client = $app->db->queryOneRecord("SELECT default_dbserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $websrv['sys_groupid']);

0 commit comments

Comments
 (0)