diff --git a/actions/admin/settings/135.fcgid.php b/actions/admin/settings/135.fcgid.php
index ed43d2b1..e225dc7d 100644
--- a/actions/admin/settings/135.fcgid.php
+++ b/actions/admin/settings/135.fcgid.php
@@ -28,30 +28,6 @@ return array(
'default' => false,
'save_method' => 'storeSettingField',
'overview_option' => true
- ),
- 'system_mod_fcgid_enabled_ownvhost' => array(
- 'label' => $lng['serversettings']['mod_fcgid_ownvhost'],
- 'settinggroup' => 'system',
- 'varname' => 'mod_fcgid_ownvhost',
- 'type' => 'bool',
- 'default' => false,
- 'save_method' => 'storeSettingField',
- ),
- 'system_mod_fcgid_httpuser' => array(
- 'label' => $lng['admin']['mod_fcgid_user'],
- 'settinggroup' => 'system',
- 'varname' => 'mod_fcgid_httpuser',
- 'type' => 'string',
- 'default' => 'froxlorlocal',
- 'save_method' => 'storeSettingField',
- ),
- 'system_mod_fcgid_httpgroup' => array(
- 'label' => $lng['admin']['mod_fcgid_group'],
- 'settinggroup' => 'system',
- 'varname' => 'mod_fcgid_httpgroup',
- 'type' => 'string',
- 'default' => 'froxlorlocal',
- 'save_method' => 'storeSettingField',
),
'system_mod_fcgid_configdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['configdir'],
@@ -117,9 +93,43 @@ return array(
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField',
),
- ),
- ),
- ),
+ 'system_mod_fcgid_enabled_ownvhost' => array(
+ 'label' => $lng['serversettings']['mod_fcgid_ownvhost'],
+ 'settinggroup' => 'system',
+ 'varname' => 'mod_fcgid_ownvhost',
+ 'type' => 'bool',
+ 'default' => false,
+ 'save_method' => 'storeSettingField',
+ ),
+ 'system_mod_fcgid_httpuser' => array(
+ 'label' => $lng['admin']['mod_fcgid_user'],
+ 'settinggroup' => 'system',
+ 'varname' => 'mod_fcgid_httpuser',
+ 'type' => 'string',
+ 'default' => 'froxlorlocal',
+ 'save_method' => 'storeSettingField',
+ ),
+ 'system_mod_fcgid_httpgroup' => array(
+ 'label' => $lng['admin']['mod_fcgid_group'],
+ 'settinggroup' => 'system',
+ 'varname' => 'mod_fcgid_httpgroup',
+ 'type' => 'string',
+ 'default' => 'froxlorlocal',
+ 'save_method' => 'storeSettingField',
+ ),
+ 'system_mod_fcgid_defaultini_ownvhost' => array(
+ 'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
+ 'settinggroup' => 'system',
+ 'varname' => 'mod_fcgid_defaultini_ownvhost',
+ 'type' => 'option',
+ 'default' => '1',
+ 'option_mode' => 'one',
+ 'option_options_method' => 'getPhpConfigs',
+ 'save_method' => 'storeSettingField',
+ ),
+ )
+ )
+ )
);
?>
diff --git a/install/froxlor.sql b/install/froxlor.sql
index f9b94c7d..e8f28bf1 100644
--- a/install/froxlor.sql
+++ b/install/froxlor.sql
@@ -460,7 +460,7 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (18, 'system', 'vmail_homedir', '/var/customers/mail/');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (19, 'system', 'bindconf_directory', '/etc/bind/');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (20, 'system', 'bindreload_command', '/etc/init.d/bind9 reload');
-INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.13');
+INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.14-svn1');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (23, 'system', 'hostname', 'SERVERNAME');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (24, 'login', 'maxloginattempts', '3');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (25, 'login', 'deactivatetime', '900');
@@ -589,6 +589,7 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (149, 'perl', 'suexecworkaround', '0');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (150, 'perl', 'suexecpath', '/var/www/cgi-bin/');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (151, 'system', 'awstats_awstatspath', '/usr/bin/');
+INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (152, 'system', 'mod_fcgid_defaultini_ownvhost', '1');
# --------------------------------------------------------
diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php
index 09801294..9af63ca4 100644
--- a/install/updates/froxlor/0.9/update_0.9.inc.php
+++ b/install/updates/froxlor/0.9/update_0.9.inc.php
@@ -1072,3 +1072,16 @@ if(isFroxlorVersion('0.9.13-svn1'))
updateToVersion('0.9.13');
}
+
+if(isFroxlorVersion('0.9.13'))
+{
+ showUpdateStep("Updating from 0.9.13 to 0.9.14-svn1", false);
+
+ $update_defaultini_ownvhost = isset($_POST['update_defaultini_ownvhost']) ? (int)$_POST['update_defaultini_ownvhost'] : 1;
+
+ showUpdateStep("Adding settings for Froxlor-vhost's PHP-configuration");
+ $db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'mod_fcgid_defaultini_ownvhost', '".(int)$update_defaultini_ownvhost."');");
+ lastStepStatus(0);
+
+ updateToVersion('0.9.14-svn1');
+}
diff --git a/install/updates/preconfig/0.9/preconfig_0.9.inc.php b/install/updates/preconfig/0.9/preconfig_0.9.inc.php
index 96936949..5f5a71d1 100644
--- a/install/updates/preconfig/0.9/preconfig_0.9.inc.php
+++ b/install/updates/preconfig/0.9/preconfig_0.9.inc.php
@@ -291,4 +291,23 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}
+
+ if(versionInUpdate($current_version, '0.9.14-svn1'))
+ {
+ if((int)$settings['system']['mod_fcgid_ownvhost'] == 1)
+ {
+ $has_preconfig = true;
+ $description = 'You have FCGID for Froxlor itself activated. You can now specify a PHP-configuration for this.';
+ $question = 'Select Froxlor-vhost PHP configuration: ';
+ $question .= '';
+ eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
+ }
+ }
}
diff --git a/lib/tables.inc.php b/lib/tables.inc.php
index 032094fe..1142e628 100644
--- a/lib/tables.inc.php
+++ b/lib/tables.inc.php
@@ -72,7 +72,7 @@ define('PACKAGE_ENABLED', 2);
// VERSION INFO
-$version = '0.9.13';
+$version = '0.9.14-svn1';
$dbversion = '2';
$branding = '';
diff --git a/lng/english.lng.php b/lng/english.lng.php
index 0ba0021b..077e8395 100644
--- a/lng/english.lng.php
+++ b/lng/english.lng.php
@@ -548,7 +548,7 @@ $lng['panel']['back'] = 'Back';
$lng['serversettings']['mod_log_sql']['title'] = 'Temporary save logs in the database';
$lng['serversettings']['mod_log_sql']['description'] = 'Use mod_log_sql to save webrequests temporarily
This needs a special apache-configuration!';
$lng['serversettings']['mod_fcgid']['title'] = 'Include PHP via mod_fcgid/suexec';
-$lng['serversettings']['mod_fcgid']['description'] = 'Use mod_fcgid/suexec/libnss_mysql to run PHP with the corresponding useraccount.
This needs a special Webserver configuration. All following options are only valid if the module is enabled.';
+$lng['serversettings']['mod_fcgid']['description'] = 'Use mod_fcgid/suexec/libnss_mysql to run PHP with the corresponding useraccount.
This needs a special Webserver configuration, see http://wiki.froxlor.org/contrib/fcgid-handbook';
$lng['serversettings']['sendalternativemail']['title'] = 'Use alternative email-address';
$lng['serversettings']['sendalternativemail']['description'] = 'Send the password-email to a different address during email-account-creation';
$lng['emails']['alternative_emailaddress'] = 'Alternative e-mail-address';
@@ -1456,7 +1456,7 @@ $lng['serversettings']['perl_path']['description'] = 'Only relevant if you use l
// ADDED IN FROXLOR 0.9.12-svn1
$lng['admin']['fcgid_settings'] = 'FCGID';
$lng['serversettings']['mod_fcgid_ownvhost']['title'] = 'Enable FCGID for the Froxlor vhost';
-$lng['serversettings']['mod_fcgid_ownvhost']['description'] = 'If enabled, Froxlor will also be running under a local user
ATTENTION:This needs manual configuration, see http://wiki.froxlor.org/contrib/fcgid-handbook';
+$lng['serversettings']['mod_fcgid_ownvhost']['description'] = 'If enabled, Froxlor will also be running under a local user';
$lng['admin']['mod_fcgid_user'] = 'Local user to use for FCGID (Froxlor vhost)';
$lng['admin']['mod_fcgid_group'] = 'Local group to use for FCGID (Froxlor vhost)';
@@ -1503,4 +1503,7 @@ $lng['admin']['store_defaultindex'] = 'Store default index-file to customers doc
// ADDED IN FROXLOR 0.9.13-svn1
$lng['customer']['autoresponder'] = 'Autoresponder';
+// ADDED IN FROXLOR 0.9.14-svn1
+$lng['serversettings']['mod_fcgid']['defaultini_ownvhost'] = 'Default PHP configuration for Froxlor-vhost';
+
?>
diff --git a/lng/german.lng.php b/lng/german.lng.php
index e494c817..7aaf239f 100644
--- a/lng/german.lng.php
+++ b/lng/german.lng.php
@@ -578,7 +578,7 @@ $lng['serversettings']['mysql_access_host']['description'] = 'Eine durch Komma g
// CHANGED IN 1.2.18
$lng['serversettings']['mod_log_sql']['description'] = 'mod_log_sql benutzen um die Webzugriffe temporär zu speichern
Dies benötigt eine spezielle Apache-Konfiguration';
-$lng['serversettings']['mod_fcgid']['description'] = 'mod_fcgid/suexec/libnss_mysql benutzen um PHP unter dem jeweiligen Useraccount laufen zu lassen
Dies benötigt eine spezielle Webserver-Konfiguration. Alle nachfolgenden Optionen sind nur gültig wenn das Modul aktiviert wird.';
+$lng['serversettings']['mod_fcgid']['description'] = 'mod_fcgid/suexec/libnss_mysql benutzen um PHP unter dem jeweiligen Useraccount laufen zu lassen
Dies benötigt eine spezielle Webserver-Konfiguration, siehe http://wiki.froxlor.org/contrib/fcgid-handbook.';
// ADDED IN 1.2.18-svn1
@@ -1439,7 +1439,7 @@ $lng['serversettings']['perl_path']['description'] = 'Nur nötig für li
// ADDED IN FROXLOR 0.9.12-svn1
$lng['admin']['fcgid_settings'] = 'FCGID';
$lng['serversettings']['mod_fcgid_ownvhost']['title'] = 'Verwende FCGID im Froxlor Vhost';
-$lng['serversettings']['mod_fcgid_ownvhost']['description'] = 'Wenn verwendet, wird Froxlor selbst unter einem lokalem Benutzer ausgeführt
ACHTUNG:Hierzu müssen noch zusätzliche Konfigurationen vorgenommen werden, siehe http://wiki.froxlor.org/contrib/fcgid-handbook';
+$lng['serversettings']['mod_fcgid_ownvhost']['description'] = 'Wenn verwendet, wird Froxlor selbst unter einem lokalem Benutzer ausgeführt';
$lng['admin']['mod_fcgid_user'] = 'Lokaler Benutzer für FCGID (Froxlor Vhost)';
$lng['admin']['mod_fcgid_group'] = 'Lokale Gruppe für FCGID (Froxlor Vhost)';
@@ -1486,4 +1486,7 @@ $lng['admin']['store_defaultindex'] = 'Erstelle standard Index-Datei in Kunden-O
// ADDED IN FROXLOR 0.9.13-svn1
$lng['customer']['autoresponder'] = 'Abwesenheitsnachrichten';
+// ADDED IN FROXLOR 0.9.14-svn1
+$lng['serversettings']['mod_fcgid']['defaultini_ownvhost'] = 'Voreingestellte PHP Konfiguration für den Froxlor-Vhost';
+
?>
diff --git a/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php b/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php
index 78ab577d..4d90e848 100644
--- a/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php
+++ b/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php
@@ -286,6 +286,7 @@ class apache_fcgid extends apache
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__)))); // /var/www/froxlor, needed for chown
$configdir = makeCorrectDir($this->settings['system']['mod_fcgid_configdir'] . '/froxlor.panel/');
$starter_filename = makeCorrectFile($configdir . '/php-fcgi-starter');
+ $phpini_filename = makeCorrectFile($configdir . '/php.ini');
$tmpdir = makeCorrectDir($this->settings['system']['mod_fcgid_tmpdir'] . '/froxlor.panel/');
$user = $this->settings['system']['mod_fcgid_httpuser'];
@@ -310,10 +311,8 @@ class apache_fcgid extends apache
safe_exec('chmod 0750 ' . escapeshellarg($tmpdir));
}
- // we only need this for some basic, no special parameters that
- // would require to maybe allow selecting a specific php.ini
- // because we only need the binary and spawning parameters
- $phpconfig = $this->getPhpConfig(0);
+ // get php.ini for our own vhost
+ $phpconfig = $this->getPhpConfig((int)$this->settings['system']['mod_fcgid_defaultini_ownvhost']);
// create starter
$starter_file = "#!/bin/sh\n\n";
@@ -358,6 +357,37 @@ class apache_fcgid extends apache
safe_exec('chmod 750 ' . escapeshellarg($starter_filename));
safe_exec('chown ' . $user . ':' . $group . ' ' . escapeshellarg($starter_filename));
setImmutable($starter_filename);
+
+ // define the php.ini
+
+ $php_ini_variables = array(
+ 'SAFE_MODE' => 'Off',
+ 'PEAR_DIR' => $this->settings['system']['mod_fcgid_peardir'],
+ 'OPEN_BASEDIR' => 'none',
+ 'OPEN_BASEDIR_C' => ';',
+ 'OPEN_BASEDIR_GLOBAL' => '',
+ 'TMP_DIR' => $tmpdir,
+ 'CUSTOMER_EMAIL' => $this->settings['panel']['adminmail'],
+ 'ADMIN_EMAIL' => $this->settings['panel']['adminmail'],
+ 'DOMAIN' => $this->settings['system']['hostname'],
+ 'CUSTOMER' => $user,
+ 'ADMIN' => $user
+ );
+
+ //insert a small header for the file
+
+ $phpini_file = ";\n";
+ $phpini_file.= "; php.ini created/changed on " . date("Y.m.d H:i:s") . " for Froxlor-vhost from php template '" . $phpconfig['description'] . "' with id #" . $phpconfig['id'] . "\n";
+ $phpini_file.= "; Do not change anything in this file, it will be overwritten by the Froxlor Cronjob!\n";
+ $phpini_file.= ";\n\n";
+ $phpini_file.= replace_variables($phpconfig['phpsettings'], $php_ini_variables);
+ $phpini_file = str_replace('"none"', 'none', $phpini_file);
+ $phpini_file = preg_replace('/\"+/', '"', $phpini_file);
+ $phpini_file_handler = fopen($phpini_filename, 'w');
+ fwrite($phpini_file_handler, $phpini_file);
+ fclose($phpini_file_handler);
+ safe_exec('chown root:0 ' . escapeshellarg($phpini_filename));
+ safe_exec('chmod 0644 ' . escapeshellarg($phpini_filename));
}
}