make fpm socket directory a setting, fixes #1300

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-11-14 09:29:55 +01:00
parent 12800b730d
commit e25597106e
15 changed files with 79 additions and 26 deletions

View File

@@ -62,7 +62,7 @@ return array(
'default' => '1',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'system_phpfpm_defaultini_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
@@ -72,7 +72,7 @@ return array(
'default' => '1',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'system_phpfpm_configdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['configdir'],
@@ -81,7 +81,7 @@ return array(
'type' => 'string',
'string_type' => 'confdir',
'default' => '/etc/php-fpm.d/',
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'system_phpfpm_aliasconfigdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['aliasconfigdir'],
@@ -90,7 +90,7 @@ return array(
'type' => 'string',
'string_type' => 'confdir',
'default' => '/var/www/php-fpm/',
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'system_phpfpm_tmpdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
@@ -99,7 +99,7 @@ return array(
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'system_phpfpm_peardir' => array(
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
@@ -108,7 +108,16 @@ return array(
'type' => 'string',
'string_type' => 'dir',
'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'system_phpfpm_fastcgi_ipcdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['ipcdir'],
'settinggroup' => 'phpfpm',
'varname' => 'fastcgi_ipcdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/lib/apache2/fastcgi/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_reload' => array(
'label' => $lng['serversettings']['phpfpm_settings']['reload'],
@@ -116,7 +125,7 @@ return array(
'varname' => 'reload',
'type' => 'string',
'default' => '/etc/init.d/php-fpm restart',
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'system_phpfpm_pm' => array(
'label' => $lng['serversettings']['phpfpm_settings']['pm'],
@@ -126,7 +135,7 @@ return array(
'default' => 'static',
'option_mode' => 'one',
'option_options' => array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand'),
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'system_phpfpm_max_children' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_children'],
@@ -134,7 +143,7 @@ return array(
'varname' => 'max_children',
'type' => 'int',
'default' => 1,
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'system_phpfpm_start_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['start_servers'],
@@ -142,7 +151,7 @@ return array(
'varname' => 'start_servers',
'type' => 'int',
'default' => 20,
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'system_phpfpm_min_spare_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['min_spare_servers'],
@@ -150,7 +159,7 @@ return array(
'varname' => 'min_spare_servers',
'type' => 'int',
'default' => 5,
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'system_phpfpm_max_spare_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_spare_servers'],
@@ -158,7 +167,7 @@ return array(
'varname' => 'max_spare_servers',
'type' => 'int',
'default' => 35,
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'system_phpfpm_max_requests' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_requests'],
@@ -166,7 +175,7 @@ return array(
'varname' => 'max_requests',
'type' => 'int',
'default' => 0,
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'system_phpfpm_idle_timeout' => array(
'label' => $lng['serversettings']['phpfpm_settings']['idle_timeout'],

View File

@@ -100,7 +100,8 @@ if($userinfo['change_serversettings'] == '1')
'<BASE_PATH>' => makeCorrectDir(dirname(__FILE__)),
'<BIND_CONFIG_PATH>' => makeCorrectDir($settings['system']['bindconf_directory']),
'<WEBSERVER_RELOAD_CMD>' => $settings['system']['apachereload_command'],
'<CUSTOMER_LOGS>' => makeCorrectDir($settings['system']['logfiles_directory'])
'<CUSTOMER_LOGS>' => makeCorrectDir($settings['system']['logfiles_directory']),
'<FPM_IPCDIR>' => makeCorrectDir($settings['phpfpm']['fastcgi_ipcdir'])
);
$files = '';
$configpage = '';

View File

@@ -415,6 +415,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('phpfpm', 'aliasconfigdir', '/var/www/php-fpm/'),
('phpfpm', 'defaultini', '1'),
('phpfpm', 'vhost_defaultini', '1'),
('phpfpm', 'fastcgi_ipcdir', '/var/lib/apache2/fastcgi/'),
('nginx', 'fastcgiparams', '/etc/nginx/fastcgi_params'),
('system', 'lastaccountnumber', '0'),
('system', 'lastguid', '9999'),
@@ -539,7 +540,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('panel', 'phpconfigs_hidestdsubdomain', '0'),
('panel', 'allow_theme_change_admin', '1'),
('panel', 'allow_theme_change_customer', '1'),
('panel', 'version', '0.9.31-dev1');
('panel', 'version', '0.9.31-dev2');
DROP TABLE IF EXISTS `panel_tasks`;

View File

@@ -385,12 +385,14 @@ class FroxlorInstall {
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/froxlor-htpasswd/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_htpasswddir'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/init.d/lighttpd reload' WHERE `settinggroup` = 'system' AND `varname` = 'apachereload_command'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/lighttpd.pem' WHERE `settinggroup` = 'system' AND `varname` = 'ssl_cert_file'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/var/run/lighttpd/' WHERE `settinggroup` = 'phpfpm' AND `varname` = 'fastcgi_ipcdir'");
} elseif ($this->_data['webserver'] == "nginx") {
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/nginx/sites-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_vhost'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/nginx/sites-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_diroptions'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/nginx/froxlor-htpasswd/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_htpasswddir'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/init.d/nginx reload' WHERE `settinggroup` = 'system' AND `varname` = 'apachereload_command'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/nginx/nginx.pem' WHERE `settinggroup` = 'system' AND `varname` = 'ssl_cert_file'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/var/run/nginx/' WHERE `settinggroup` = 'phpfpm' AND `varname` = 'fastcgi_ipcdir'");
}
// insert the lastcronrun to be the installation date
@@ -733,7 +735,7 @@ class FroxlorInstall {
// check for correct php version
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpversion']);
if (version_compare("5.2.0", PHP_VERSION, ">=")) {
if (version_compare("5.3.0", PHP_VERSION, ">=")) {
$content .= $this->_status_message('red', $this->_lng['requirements']['notfound'].' ('.PHP_VERSION.')');
$_die = true;
} else {

View File

@@ -2423,3 +2423,26 @@ if (isFroxlorVersion('0.9.30')) {
updateToVersion('0.9.31-dev1');
}
if (isFroxlorVersion('0.9.31-dev1')) {
showUpdateStep("Updating from 0.9.31-dev1 to 0.9.31-dev2", true);
lastStepStatus(0);
showUpdateStep("Adding new phpfpm-ipcdir setting");
$ins_stmt = Database::prepare("
INSERT INTO `".TABLE_PANEL_SETTINGS."` SET `settinggroup` = 'phpfpm', `varname` = 'fastcgi_ipcdir', `value` = :value
");
$params = array();
if ($settings['system']['webserver'] == 'apache2') {
$params['value'] = '/var/lib/apache2/fastcgi/';
} elseif ($settings['system']['webserver'] == 'lighttpd') {
$params['value'] = '/var/run/lighttpd/';
} elseif ($settings['system']['webserver'] == 'nginx') {
$params['value'] = '/var/run/nginx/';
}
Database::pexecute($ins_stmt, $params);
lastStepStatus(0);
updateToVersion('0.9.31-dev2');
}

View File

@@ -561,7 +561,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
$has_preconfig = true;
$description = 'The PHP-FPM implementation for apache2 has changed. Please look for the "<b>fastcgi.conf</b>" (Debian/Ubuntu) or "<b>70_fastcgi.conf</b>" (Gentoo) within /etc/apache2/ and change it as shown below:<br /><br />';
$description .= '<pre style="width:500px;border:1px solid #ccc;padding:4px;">&lt;IfModule mod_fastcgi.c&gt;
FastCgiIpcDir /var/run/apache2/
FastCgiIpcDir /var/lib/apache2/fastcgi/
&lt;Location "/fastcgiphp"&gt;
Order Deny,Allow
Deny from All
@@ -573,4 +573,15 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}
if (versionInUpdate($current_version, '0.9.31-dev2')) {
if ($settings['system']['webserver'] == 'apache2'
&& $settings['phpfpm']['enabled'] == '1'
) {
$has_preconfig = true;
$description = 'The FPM socket directory is now a setting in froxlor. Its default is <b>/var/lib/apache2/fastcgi/</b>.<br/>If you are using <b>/var/run/apache2</b> in the "<b>fastcgi.conf</b>" (Debian/Ubuntu) or "<b>70_fastcgi.conf</b>" (Gentoo) please correct this path accordingly<br />';
$question = '';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}
}

View File

@@ -287,7 +287,9 @@ class phpinterface_fpm {
*/
public function getSocketFile($createifnotexists = true) {
$socketdir = makeCorrectDir('/var/run/'.$this->_settings['system']['webserver'].'/');
// see #1300 why this has changed
//$socketdir = makeCorrectDir('/var/run/'.$this->_settings['system']['webserver'].'/');
$socketdir = makeCorrectDir($this->_settings['phpfpm']['fastcgi_ipcdir']);
$socket = makeCorrectFile($socketdir.'/'.$this->_domain['loginname'].'-'.$this->_domain['domain'].'-php-fpm.socket');
if (!is_dir($socketdir) && $createifnotexists) {

View File

@@ -71,6 +71,6 @@ define('PACKAGE_LOCKED', 1);
define('PACKAGE_ENABLED', 2);
// VERSION INFO
$version = '0.9.31-dev1';
$version = '0.9.31-dev2';
$dbversion = '2';
$branding = '';

View File

@@ -1975,4 +1975,6 @@ $lng['panel']['dashboard'] = "Dashboard";
$lng['panel']['used'] = "used";
$lng['panel']['assigned'] = "assigned";
$lng['panel']['available'] = "available";
$lng['customer']['services'] = "Services";
$lng['customer']['services'] = "Services";
$lng['serversettings']['phpfpm_settings']['ipcdir']['title'] = 'FastCGI IPC directory';
$lng['serversettings']['phpfpm_settings']['ipcdir']['description'] = 'The directory where the php-fpm sockets will be stored by the webserver.<br />This directory has to be readable for the webserver';

View File

@@ -1701,4 +1701,6 @@ $lng['panel']['dashboard'] = "Dashboard";
$lng['panel']['used'] = "genutzt";
$lng['panel']['assigned'] = "zugewiesen";
$lng['panel']['available'] = "verfügbar";
$lng['customer']['services'] = "Dienste";
$lng['customer']['services'] = "Dienste";
$lng['serversettings']['phpfpm_settings']['ipcdir']['title'] = 'FastCGI IPC Verzeichnis';
$lng['serversettings']['phpfpm_settings']['ipcdir']['description'] = 'In dieses Verzeichnis werden die php-fpm Sockets vom Webserver abgelegt.<br />Das Verzeichnis muss für den Webserver lesbar sein.';

View File

@@ -1,5 +1,5 @@
<IfModule mod_fastcgi.c>
FastCgiIpcDir /var/run/apache2/
FastCgiIpcDir <FPM_IPCDIR>
<Location "/fastcgiphp">
Order Deny,Allow

View File

@@ -1,5 +1,5 @@
<IfModule mod_fastcgi.c>
FastCgiIpcDir /var/run/apache2/
FastCgiIpcDir <FPM_IPCDIR>
<Location "/fastcgiphp">
Order Deny,Allow

View File

@@ -1,5 +1,5 @@
<IfModule mod_fastcgi.c>
FastCgiIpcDir /var/run/apache2/
FastCgiIpcDir <FPM_IPCDIR>
<Location "/fastcgiphp">
Order Deny,Allow

View File

@@ -1,5 +1,5 @@
<IfModule mod_fastcgi.c>
FastCgiIpcDir /var/run/apache2/
FastCgiIpcDir <FPM_IPCDIR>
<Location "/fastcgiphp">
Order Deny,Allow

View File

@@ -1,5 +1,5 @@
<IfModule mod_fastcgi.c>
FastCgiIpcDir /var/run/apache2/
FastCgiIpcDir <FPM_IPCDIR>
<Location "/fastcgiphp">
Order Deny,Allow