Compare commits

...

32 Commits

Author SHA1 Message Date
Michael Kaufmann (d00p)
94c94d2d14 Tagging Froxlor 0.9.16 2010-12-28 11:10:44 +00:00
Michael Kaufmann (d00p)
57ec429776 settings version for upcoming release 2010-12-28 11:07:40 +00:00
Andreas Burchert (scarya)
c52d3819af - forgot some update queries from early installations (regarding #529) 2010-12-25 23:36:26 +00:00
Andreas Burchert (scarya)
85f35abe2d - changed sql query to work with version <= 5.5 (fixes #529)
- added php-xml extension check ti installation (fixes #530)
-> thanks to lando
2010-12-25 22:43:42 +00:00
Michael Kaufmann (d00p)
58674a2f8f - fix possible undefined variable 2010-12-22 13:10:12 +00:00
Michael Kaufmann (d00p)
968137a967 - use php symlink to binary, fixes #526 2010-12-22 12:47:31 +00:00
Michael Kaufmann (d00p)
66b274c1bf - fine-tune php-fpm-config, create tmp-folder if not exists, refs #524 2010-12-21 13:15:26 +00:00
Michael Kaufmann (d00p)
b9d68a17fa fix deletion of htpasswd/diroption files if no more htpasswds/diroptions are in the database 2010-12-21 10:55:08 +00:00
Michael Kaufmann (d00p)
ced64138e8 fix order of variables in configuration-path, fixes #521 2010-12-17 22:28:28 +00:00
Michael Kaufmann (d00p)
4fdaed5cc4 fix 'new' fcgid path for froxlor's own vhost php-fcgi-starter 2010-12-14 21:19:52 +00:00
Michael Kaufmann (d00p)
0fd11afdcb use makeCorrectDir() to output sane path 2010-12-10 12:16:03 +00:00
Michael Kaufmann (d00p)
8202cc96e7 - fixed double-declaration of variable causing nginx-cron to fail on mysql_fetch_array() for htpasswd-entries, fixes #516 2010-12-09 11:49:07 +00:00
Michael Kaufmann (d00p)
59bf7ba22f - restore still used settings in 120.system.php
- check for $createifnotexists in phpinterface_* classes
2010-12-07 11:08:41 +00:00
Michael Kaufmann (d00p)
9c075c05f5 - don't create standard-openbasedir config for froxlor-panel vhost 2010-12-06 09:17:48 +00:00
Michael Kaufmann (d00p)
6815501c1d - use local-username for froxlor in fpm-config, because froxlor.panel is only the directory/loginname 2010-12-06 09:00:53 +00:00
Michael Kaufmann (d00p)
f11aa9a1c4 - forgot to save lighttpd_fcgid-class with own-vhost settings for php-fpm 2010-12-06 08:56:39 +00:00
Michael Kaufmann (d00p)
3b33dde9ac add language-strings for php-fpm settings 2010-12-06 08:49:24 +00:00
Michael Kaufmann (d00p)
7fb0e88313 - implement php-fpm for Froxlor-vhost, fixes #505 2010-12-06 07:38:55 +00:00
Michael Kaufmann (d00p)
9615aaa83a update dutch language file, thx to Frits Letteboer, fixes #506 2010-12-05 17:18:24 +00:00
Michael Kaufmann (d00p)
16cc53146c replace correct line-break when sending forgotten password, fixes #507 2010-12-05 17:15:24 +00:00
Michael Kaufmann (d00p)
56e9f748f4 beautify update (forgot one status-output) 2010-12-03 11:15:58 +00:00
Michael Kaufmann (d00p)
80e338610f don't allow activation of FCGID and PHP-FPM at the same time 2010-12-03 10:41:12 +00:00
Michael Kaufmann (d00p)
93abbf4a10 - hide php-reload and php-backend-server setting if nginx is used with php-fpm (useless settings) 2010-12-03 10:20:49 +00:00
Michael Kaufmann (d00p)
0271ccfc28 - outsource fcgid/php-fpm configurations/file-creations/etc 2010-12-03 09:23:40 +00:00
Michael Kaufmann (d00p)
dae3e416a2 - include nginx_phpfpm cron in cron_tasks.php
- show parts of fcgid also when lighttpd is used
2010-12-03 08:58:44 +00:00
Michael Kaufmann (d00p)
759213f8b9 add extra configuration for Apache + PHP-FPM, fixes #482 2010-12-02 12:51:14 +00:00
Michael Kaufmann (d00p)
01b313a3ce merged php-fpm branch 2010-12-02 12:15:58 +00:00
Michael Kaufmann (d00p)
4567f7c781 only call validatePassword() when creating a customer if the password is not empty, cause otherwise no random password can be generated if field is left empty 2010-12-02 09:52:56 +00:00
Michael Kaufmann (d00p)
ef76635508 added missing language-definitions for integer-validation 2010-12-02 08:25:01 +00:00
Michael Kaufmann (d00p)
30235ff3eb don't show settings which are not needed for used webserver, fixes #502 2010-12-02 08:18:46 +00:00
Michael Kaufmann (d00p)
ebb390a1fd fix false initialization of variable (wrong variable name) 2010-11-30 10:45:51 +00:00
Michael Kaufmann (d00p)
0c1a4f692a fix password_query for dovecot when sending e-mail, fixes #500 2010-11-30 07:50:49 +00:00
51 changed files with 2773 additions and 690 deletions

View File

@@ -29,6 +29,7 @@ return array(
'type' => 'string',
'default' => '/var/customers/webs/',
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkPathConflicts'
),
'system_ipaddress' => array(
'label' => $lng['serversettings']['ipaddress'],
@@ -58,6 +59,22 @@ return array(
'default' => '',
'save_method' => 'storeSettingHostname',
),
'system_froxlordirectlyviahostname' => array(
'label' => $lng['serversettings']['froxlordirectlyviahostname'],
'settinggroup' => 'system',
'varname' => 'froxlordirectlyviahostname',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'system_stdsubdomain' => array(
'label' => $lng['serversettings']['stdsubdomainhost'],
'settinggroup' => 'system',
'varname' => 'stdsubdomain',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingHostname',
),
'system_mysql_access_host' => array(
'label' => $lng['serversettings']['mysql_access_host'],
'settinggroup' => 'system',

View File

@@ -76,38 +76,6 @@ return array(
'default' => '/etc/apache2/htpasswd/',
'save_method' => 'storeSettingField',
),
'system_apachereload_command' => array(
'label' => $lng['serversettings']['apachereload_command'],
'settinggroup' => 'system',
'varname' => 'apachereload_command',
'type' => 'string',
'default' => '/etc/init.d/apache2 reload',
'save_method' => 'storeSettingField',
),
'system_phpreload_command' => array(
'label' => $lng['serversettings']['phpreload_command'],
'settinggroup' => 'system',
'varname' => 'phpreload_command',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
),
'system_nginx_php_backend' => array(
'label' => $lng['serversettings']['nginx_php_backend'],
'settinggroup' => 'system',
'varname' => 'nginx_php_backend',
'type' => 'string',
'default' => '127.0.0.1:8888',
'save_method' => 'storeSettingField',
),
'system_mod_log_sql' => array(
'label' => $lng['serversettings']['mod_log_sql'],
'settinggroup' => 'system',
'varname' => 'mod_log_sql',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'system_logfiles_directory' => array(
'label' => $lng['serversettings']['logfiles_directory'],
'settinggroup' => 'system',
@@ -144,6 +112,41 @@ return array(
'default' => '',
'save_method' => 'storeSettingField',
),
'system_apachereload_command' => array(
'label' => $lng['serversettings']['apachereload_command'],
'settinggroup' => 'system',
'varname' => 'apachereload_command',
'type' => 'string',
'default' => '/etc/init.d/apache2 reload',
'save_method' => 'storeSettingField',
),
'system_phpreload_command' => array(
'label' => $lng['serversettings']['phpreload_command'],
'settinggroup' => 'system',
'varname' => 'phpreload_command',
'type' => (getSetting('phpfpm', 'enabled') == '1') ? 'hidden' : 'string',
'default' => '',
'save_method' => 'storeSettingField',
'websrv_avail' => array('nginx')
),
'system_nginx_php_backend' => array(
'label' => $lng['serversettings']['nginx_php_backend'],
'settinggroup' => 'system',
'varname' => 'nginx_php_backend',
'type' => (getSetting('phpfpm', 'enabled') == '1') ? 'hidden' : 'string',
'default' => '127.0.0.1:8888',
'save_method' => 'storeSettingField',
'websrv_avail' => array('nginx')
),
'system_mod_log_sql' => array(
'label' => $lng['serversettings']['mod_log_sql'],
'settinggroup' => 'system',
'varname' => 'mod_log_sql',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'defaultwebsrverrhandler_enabled' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_enabled'],
'settinggroup' => 'defaultwebsrverrhandler',
@@ -159,6 +162,7 @@ return array(
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'nginx')
),
'defaultwebsrverrhandler_err403' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err403'],
@@ -167,6 +171,7 @@ return array(
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'nginx')
),
'defaultwebsrverrhandler_err404' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err404'],
@@ -183,6 +188,7 @@ return array(
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'nginx')
),
'customredirect_enabled' => array(
'label' => $lng['serversettings']['customredirect_enabled'],
@@ -191,6 +197,7 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'lighttpd')
),
'customredirect_default' => array(
'label' => $lng['serversettings']['customredirect_default'],
@@ -201,6 +208,7 @@ return array(
'option_mode' => 'one',
'option_options_method' => 'getRedirectCodes',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'lighttpd')
),
),
),

View File

@@ -19,6 +19,7 @@ return array(
'groups' => array(
'fcgid' => array(
'title' => $lng['admin']['fcgid_settings'],
'websrv_avail' => array('apache2', 'lighttpd'),
'fields' => array(
'system_mod_fcgid_enabled' => array(
'label' => $lng['serversettings']['mod_fcgid'],
@@ -27,6 +28,7 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkFcgidPhpFpm',
'overview_option' => true
),
'system_mod_fcgid_configdir' => array(
@@ -67,6 +69,7 @@ return array(
'option_options' => array(0 => 'ScriptAlias', 1=> 'FCGIWrapper'),
'default' => 1,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_mod_fcgid_starter' => array(
'label' => $lng['serversettings']['mod_fcgid']['starter'],
@@ -101,6 +104,7 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_mod_fcgid_httpuser' => array(
'label' => $lng['admin']['mod_fcgid_user'],
@@ -109,6 +113,7 @@ return array(
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_mod_fcgid_httpgroup' => array(
'label' => $lng['admin']['mod_fcgid_group'],
@@ -117,6 +122,7 @@ return array(
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_mod_fcgid_defaultini_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
@@ -127,6 +133,7 @@ return array(
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
)
)

View File

@@ -0,0 +1,161 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
* @version $Id$
*/
return array(
'groups' => array(
'phpfpm' => array(
'title' => $lng['admin']['phpfpm_settings'],
'fields' => array(
'system_phpfpm_enabled' => array(
'label' => $lng['serversettings']['phpfpm'],
'settinggroup' => 'phpfpm',
'varname' => 'enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkFcgidPhpFpm',
'overview_option' => true
),
'system_phpfpm_enabled_ownvhost' => array(
'label' => $lng['phpfpm']['ownvhost'],
'settinggroup' => 'phpfpm',
'varname' => 'enabled_ownvhost',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
'system_phpfpm_httpuser' => array(
'label' => $lng['phpfpm']['vhost_httpuser'],
'settinggroup' => 'phpfpm',
'varname' => 'vhost_httpuser',
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField'
),
'system_phpfpm_httpgroup' => array(
'label' => $lng['phpfpm']['vhost_httpgroup'],
'settinggroup' => 'phpfpm',
'varname' => 'vhost_httpgroup',
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField'
),
/*
* @TODO implement if phpfpm knows custom php.ini files
*
'system_phpfpm_defaultini_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
'settinggroup' => 'phpfpm',
'varname' => 'vhost_defaultini',
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField',
),
*/
'system_phpfpm_configdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['configdir'],
'settinggroup' => 'phpfpm',
'varname' => 'configdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/etc/php-fpm.d/',
'save_method' => 'storeSettingField',
),
'system_phpfpm_tmpdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
'settinggroup' => 'phpfpm',
'varname' => 'tmpdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField',
),
'system_phpfpm_peardir' => array(
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
'settinggroup' => 'phpfpm',
'varname' => 'peardir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField',
),
'system_phpfpm_reload' => array(
'label' => $lng['serversettings']['phpfpm_settings']['reload'],
'settinggroup' => 'phpfpm',
'varname' => 'reload',
'type' => 'string',
'default' => '/etc/init.d/php-fpm restart',
'save_method' => 'storeSettingField',
),
'system_phpfpm_pm' => array(
'label' => $lng['serversettings']['phpfpm_settings']['pm'],
'settinggroup' => 'phpfpm',
'varname' => 'pm',
'type' => 'option',
'default' => 'static',
'option_mode' => 'one',
'option_options' => array('static' => 'static', 'dynamic' => 'dynamic'),
'save_method' => 'storeSettingField',
),
'system_phpfpm_max_children' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_children'],
'settinggroup' => 'phpfpm',
'varname' => 'max_children',
'type' => 'int',
'default' => 1,
'save_method' => 'storeSettingField',
),
'system_phpfpm_start_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['start_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'start_servers',
'type' => 'int',
'default' => 20,
'save_method' => 'storeSettingField',
),
'system_phpfpm_min_spare_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['min_spare_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'min_spare_servers',
'type' => 'int',
'default' => 5,
'save_method' => 'storeSettingField',
),
'system_phpfpm_max_spare_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_spare_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'max_spare_servers',
'type' => 'int',
'default' => 35,
'save_method' => 'storeSettingField',
),
'system_phpfpm_max_requests' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_requests'],
'settinggroup' => 'phpfpm',
'varname' => 'max_requests',
'type' => 'int',
'default' => 0,
'save_method' => 'storeSettingField',
),
),
),
),
);
?>

View File

@@ -27,6 +27,7 @@ return array(
'type' => 'string',
'default' => '/usr/bin/perl',
'save_method' => 'storeSettingField',
'websrv_avail' => array('lighttpd')
),
'system_perl_suexecworkaround' => array(
'label' => $lng['serversettings']['perl']['suexecworkaround'],
@@ -35,6 +36,7 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_perl_suexeccgipath' => array(
'label' => $lng['serversettings']['perl']['suexeccgipath'],
@@ -43,6 +45,7 @@ return array(
'type' => 'string',
'default' => '/var/www/cgi-bin/',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'perl_server' => array(
'label' => $lng['serversettings']['perl_server'],
@@ -51,6 +54,7 @@ return array(
'type' => 'string',
'default' => 'unix:/var/run/nginx/cgiwrap-dispatch.sock',
'save_method' => 'storeSettingField',
'websrv_avail' => array('nginx')
),
),
),

View File

@@ -474,7 +474,12 @@ if($page == 'customers'
$createstdsubdomain = intval($_POST['createstdsubdomain']);
$password = validate($_POST['new_customer_password'], 'password');
$password = validatePassword($password);
// only check if not empty,
// cause empty == generate password automatically
if($password != '')
{
$password = validatePassword($password);
}
$sendpassword = intval($_POST['sendpassword']);
$phpenabled = intval($_POST['phpenabled']);
$perlenabled = intval($_POST['perlenabled']);

View File

@@ -195,7 +195,7 @@ elseif($page == 'accounts')
$result = $db->query("SELECT `bytes_in_used` FROM `" . TABLE_FTP_QUOTATALLIES . "` WHERE `name` = '" . $userinfo['loginname'] . "'");
while($row = $db->fetch_array($result))
{
$db->query("INSERT INTO `" . TABLE_FTP_QUOTATALLIES . "` (`name`, `quota_type`, `bytes_in_used`, `bytes_out_used`, `bytes_xfer_used`, `files_in_used`, `files_out_used`, `files_xfer_used`) VALUES ('" . $db->escape($username) . "', 'user', '" . $db->escape($row[bytes_in_used]) . "', '0', '0', '0', '0', '0')");
$db->query("INSERT INTO `" . TABLE_FTP_QUOTATALLIES . "` (`name`, `quota_type`, `bytes_in_used`, `bytes_out_used`, `bytes_xfer_used`, `files_in_used`, `files_out_used`, `files_xfer_used`) VALUES ('" . $db->escape($username) . "', 'user', '" . $db->escape($row['bytes_in_used']) . "', '0', '0', '0', '0', '0')");
}
$db->query("UPDATE `" . TABLE_FTP_GROUPS . "` SET `members`=CONCAT_WS(',',`members`,'" . $db->escape($username) . "') WHERE `customerid`='" . $userinfo['customerid'] . "' AND `gid`='" . (int)$userinfo['guid'] . "'");
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `ftps_used`=`ftps_used`+1, `ftp_lastaccountnumber`=`ftp_lastaccountnumber`+1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");

View File

@@ -336,7 +336,7 @@ if($action == 'forgotpwd')
try {
$mail->Subject = $mail_subject;
$mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\\n", "<br />", $mail_body));
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$mail->AddAddress($user['email'], $user['firstname'] . ' ' . $user['name']);
$mail->Send();
} catch(phpmailerException $e) {

View File

@@ -15,7 +15,7 @@ CREATE TABLE `ftp_groups` (
PRIMARY KEY (`id`),
UNIQUE KEY `groupname` (`groupname`),
KEY `customerid` (`customerid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `ftp_groups`
@@ -48,7 +48,7 @@ CREATE TABLE `ftp_users` (
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
KEY `customerid` (`customerid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `ftp_users`
@@ -80,7 +80,7 @@ CREATE TABLE `mail_users` (
`imap` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `mail_users`
@@ -105,7 +105,7 @@ CREATE TABLE `mail_virtual` (
`iscatchall` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `email` (`email`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `mail_virtual`
@@ -168,7 +168,7 @@ CREATE TABLE `panel_admins` (
`email_autoresponder_used` int(5) NOT NULL default '0',
PRIMARY KEY (`adminid`),
UNIQUE KEY `loginname` (`loginname`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
# --------------------------------------------------------
@@ -234,7 +234,7 @@ CREATE TABLE `panel_customers` (
`email_autoresponder_used` int(5) NOT NULL default '0',
PRIMARY KEY (`customerid`),
UNIQUE KEY `loginname` (`loginname`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_customers`
#
@@ -256,7 +256,7 @@ CREATE TABLE `panel_databases` (
`apsdb` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_databases`
@@ -310,7 +310,7 @@ CREATE TABLE `panel_domains` (
KEY `customerid` (`customerid`),
KEY `parentdomain` (`parentdomainid`),
KEY `domain` (`domain`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_domains`
@@ -340,7 +340,7 @@ CREATE TABLE `panel_ipsandports` (
`ssl_cert_chainfile` varchar(255) NOT NULL,
`docroot` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_ipsandports`
@@ -366,7 +366,7 @@ CREATE TABLE `panel_htaccess` (
`error401path` varchar(255) NOT NULL default '',
`options_cgi` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_htaccess`
@@ -389,7 +389,7 @@ CREATE TABLE `panel_htpasswds` (
`authname` varchar(255) NOT NULL default 'Restricted Area',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_htpasswds`
@@ -435,7 +435,7 @@ CREATE TABLE `panel_settings` (
`varname` varchar(255) NOT NULL default '',
`value` text NOT NULL,
PRIMARY KEY (`settingid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
# --------------------------------------------------------
@@ -462,7 +462,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.15');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.16');
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');
@@ -597,6 +597,20 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (156, 'system', 'nginx_php_backend', '127.0.0.1:8888');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (157, 'system', 'perl_server', 'unix:/var/run/nginx/cgiwrap-dispatch.sock');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (158, 'system', 'phpreload_command', '');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (159, 'phpfpm', 'enabled', '0');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (160, 'phpfpm', 'configdir', '/etc/php-fpm.d/');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (161, 'phpfpm', 'reload', '/etc/init.d/php-fpm restart');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (162, 'phpfpm', 'pm', 'static');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (163, 'phpfpm', 'max_children', '1');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (164, 'phpfpm', 'start_servers', '20');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (165, 'phpfpm', 'min_spare_servers', '5');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (166, 'phpfpm', 'max_spare_servers', '35');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (167, 'phpfpm', 'max_requests', '0');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (168, 'phpfpm', 'tmpdir', '/var/customers/tmp/');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (169, 'phpfpm', 'peardir', '/usr/share/php/:/usr/share/php5/');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (170, 'phpfpm', 'enabled_ownvhost', '0');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (171, 'phpfpm', 'vhost_httpuser', 'froxlorlocal');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (172, 'phpfpm', 'vhost_httpgroup', 'froxlorlocal');
# --------------------------------------------------------
@@ -610,7 +624,7 @@ CREATE TABLE `panel_tasks` (
`type` int(11) NOT NULL default '0',
`data` text NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_tasks`
@@ -633,7 +647,7 @@ CREATE TABLE `panel_templates` (
`value` longtext NOT NULL,
PRIMARY KEY (id),
KEY adminid (adminid)
) TYPE=MyISAM;
) ENGINE=MyISAM;
#
# Dumping data for table `panel_templates`
@@ -660,7 +674,7 @@ CREATE TABLE `panel_traffic` (
`mail` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_traffic`
@@ -687,7 +701,7 @@ CREATE TABLE `panel_traffic_admins` (
`mail` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `adminid` (`adminid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_traffic_admins`
@@ -713,7 +727,7 @@ CREATE TABLE `panel_diskspace` (
`mysql` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_diskspace`
@@ -738,7 +752,7 @@ CREATE TABLE `panel_diskspace_admins` (
`mysql` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `adminid` (`adminid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_diskspace_admins`
@@ -756,7 +770,7 @@ CREATE TABLE `panel_languages` (
`language` varchar(30) NOT NULL default '',
`file` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_languages`

View File

@@ -212,6 +212,20 @@ function requirement_checks()
{
status_message('green', 'OK');
}
status_message('begin', $lng['install']['phpxml']);
if(!extension_loaded('xml'))
{
status_message('red', $lng['install']['notinstalled']);
$_die = true;
}
else
{
status_message('green', 'OK');
}
status_message('begin', $lng['install']['phpfilter']);

View File

@@ -97,5 +97,5 @@ $lng['install']['froxlor_succ_checks'] = 'All requirements are satisfied';
$lng['install']['phpmagic_quotes_runtime'] = 'Checking whether magic_quotes_runtime is off';
$lng['install']['active'] = 'no';
$lng['install']['phpmagic_quotes_runtime_description'] = 'PHP setting "magic_quotes_runtime" must be set to "Off" in order to avoid strange behavior of Froxlor. Disabling it for now (this is only temporary, please fix our php.ini).';
$lng['install']['phpxml'] = 'Testing if PHP XML-extension is installed...';
?>

View File

@@ -68,4 +68,5 @@ $lng['install']['httpgroup'] = 'Nom du la group du HTTP';
$lng['install']['webserver'] = 'Version du serveur';
$lng['install']['phpxml'] = 'Tester si PHP XML-extension est install<6C>e...';
?>

View File

@@ -97,5 +97,5 @@ $lng['install']['froxlor_succ_checks'] = 'Alle Vorraussetzungen sind erf&uuml;ll
$lng['install']['phpmagic_quotes_runtime'] = 'Pr&uuml;fe ob magic_quotes_runtime ausgeschalten ist';
$lng['install']['active'] = 'nein';
$lng['install']['phpmagic_quotes_runtime_description'] = 'Die PHP Einstellung "magic_quotes_runtime" muss deaktiviert sein ("Off"), um merkw&uuml;rdige Verhalten von Froxlor zu umgehen. Sie wurde deaktiviert (nur tempor&auml;r, bitte php.ini anpassen).';
$lng['install']['phpxml'] = 'Teste, ob die PHP XML-Erweiterung installiert ist...';
?>

View File

@@ -937,7 +937,7 @@ if(isFroxlorVersion('0.9.11'))
$update_fcgid_ownvhost = isset($_POST['update_fcgid_ownvhost']) ? (int)$_POST['update_fcgid_ownvhost'] : '0';
$update_fcgid_httpuser = isset($_POST['update_fcgid_httpuser']) ? $_POST['update_fcgid_httpuser'] : 'froxlorlocal';
$update_fcgid_httpgroup = isset($_POST['update_fcgid_ownvhost']) ? $_POST['update_fcgid_ownvhost'] : 'froxlorlocal';
$update_fcgid_httpgroup = isset($_POST['update_fcgid_httpgroup']) ? $_POST['update_fcgid_httpgroup'] : 'froxlorlocal';
if($update_fcgid_httpuser == '') {
$update_fcgid_httpuser = 'froxlorlocal';
@@ -1258,6 +1258,7 @@ if(isFroxlorVersion('0.9.14'))
$db->query("INSERT INTO `".TABLE_PANEL_SETTINGS."` (`settinggroup`, `varname`, `value`) VALUES ('system', 'nginx_php_backend', '127.0.0.1:8888')");
$db->query("INSERT INTO `".TABLE_PANEL_SETTINGS."` (`settinggroup`, `varname`, `value`) VALUES ('system', 'perl_server', 'unix:/var/run/nginx/cgiwrap-dispatch.sock')");
$db->query("INSERT INTO `".TABLE_PANEL_SETTINGS."` (`settinggroup`, `varname`, `value`) VALUES ('system', 'phpreload_command', '')");
lastStepStatus(0);
updateToVersion('0.9.15-svn1');
}
@@ -1269,3 +1270,86 @@ if(isFroxlorVersion('0.9.15-svn1'))
updateToVersion('0.9.15');
}
if(isFroxlorVersion('0.9.15'))
{
showUpdateStep("Updating from 0.9.15 to 0.9.16-svn1", false);
$update_phpfpm_enabled = isset($_POST['update_phpfpm_enabled']) ? (int)$_POST['update_phpfpm_enabled'] : '0';
$update_phpfpm_configdir = isset($_POST['update_phpfpm_configdir']) ? makeCorrectDir($_POST['update_phpfpm_configdir']) : '/etc/php-fpm.d/';
$update_phpfpm_tmpdir = isset($_POST['update_phpfpm_tmpdir']) ? makeCorrectDir($_POST['update_phpfpm_tmpdir']) : '/var/customers/tmp';
$update_phpfpm_peardir = isset($_POST['update_phpfpm_peardir']) ? makeCorrectDir($_POST['update_phpfpm_peardir']) : '/usr/share/php/:/usr/share/php5/';
$update_phpfpm_reload = isset($_POST['update_phpfpm_reload']) ? $_POST['update_phpfpm_reload'] : '/etc/init.d/php-fpm restart';
$update_phpfpm_pm = isset($_POST['update_phpfpm_pm']) ? $_POST['update_phpfpm_pm'] : 'static';
$update_phpfpm_max_children = isset($_POST['update_phpfpm_max_children']) ? (int)$_POST['update_phpfpm_max_children'] : '1';
$update_phpfpm_max_requests = isset($_POST['update_phpfpm_max_requests']) ? (int)$_POST['update_phpfpm_max_requests'] : '0';
if($update_phpfpm_pm == 'dynamic')
{
$update_phpfpm_start_servers = isset($_POST['update_phpfpm_start_servers']) ? (int)$_POST['update_phpfpm_start_servers'] : '20';
$update_phpfpm_min_spare_servers = isset($_POST['update_phpfpm_min_spare_servers']) ? (int)$_POST['update_phpfpm_min_spare_servers'] : '5';
$update_phpfpm_max_spare_servers = isset($_POST['update_phpfpm_max_spare_servers']) ? (int)$_POST['update_phpfpm_max_spare_servers'] : '35';
}
else
{
$update_phpfpm_start_servers = 20;
$update_phpfpm_min_spare_servers = 5;
$update_phpfpm_max_spare_servers = 35;
}
if($update_phpfpm_configdir == '') {
$update_phpfpm_configdir = '/etc/php-fpm.d/';
}
if($update_phpfpm_reload == '') {
$update_phpfpm_reload = '/etc/init.d/php-fpm restart';
}
showUpdateStep("Adding new settings for PHP-FPM #1");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'enabled', '".(int)$update_phpfpm_enabled."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'configdir', '".$db->escape($update_phpfpm_configdir)."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'reload', '".$db->escape($update_phpfpm_reload)."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'pm', '".$db->escape($update_phpfpm_pm)."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'max_children', '".(int)$update_phpfpm_max_children."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'max_requests', '".(int)$update_phpfpm_max_requests."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'start_servers', '".(int)$update_phpfpm_start_servers."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'min_spare_servers', '".(int)$update_phpfpm_min_spare_servers."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'max_spare_servers', '".(int)$update_phpfpm_max_spare_servers."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'tmpdir', '".$db->escape($update_phpfpm_tmpdir)."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'peardir', '".$db->escape($update_phpfpm_peardir)."');");
lastStepStatus(0);
updateToVersion('0.9.16-svn1');
}
if(isFroxlorVersion('0.9.16-svn1'))
{
showUpdateStep("Updating from 0.9.16-svn1 to 0.9.16-svn2", false);
$update_phpfpm_enabled_ownvhost = isset($_POST['update_phpfpm_enabled_ownvhost']) ? (int)$_POST['update_phpfpm_enabled_ownvhost'] : '0';
$update_phpfpm_httpuser = isset($_POST['update_phpfpm_httpuser']) ? $_POST['update_phpfpm_httpuser'] : 'froxlorlocal';
$update_phpfpm_httpgroup = isset($_POST['update_phpfpm_httpgroup']) ? $_POST['update_phpfpm_httpgroup'] : 'froxlorlocal';
if($update_phpfpm_httpuser == '') {
$update_phpfpm_httpuser = 'froxlorlocal';
}
if($update_phpfpm_httpgroup == '') {
$update_phpfpm_httpgroup = 'froxlorlocal';
}
showUpdateStep("Adding new settings for PHP-FPM #2");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'enabled_ownvhost', '".(int)$update_phpfpm_enabled_ownvhost."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'vhost_httpuser', '".$db->escape($update_phpfpm_httpuser)."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'vhost_httpgroup', '".$db->escape($update_phpfpm_httpgroup)."');");
lastStepStatus(0);
updateToVersion('0.9.16-svn2');
}
if(isFroxlorVersion('0.9.16-svn2'))
{
showUpdateStep("Updating from 0.9.16-svn2 to 0.9.16 final");
lastStepStatus(0);
updateToVersion('0.9.16');
}

View File

@@ -251,7 +251,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
$question.= 'Local user:&nbsp;';
$question.= '<input type="text" class="text" name="update_fcgid_httpuser" value="froxlorlocal" /><br /><br />';
$question.= 'Local group:&nbsp;';
$question.= '<input type="text" class="text" name="update_fcgid_ownvhost" value="froxlorlocal" /><br />';
$question.= '<input type="text" class="text" name="update_fcgid_httpgroup" value="froxlorlocal" /><br />';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}
@@ -351,4 +351,54 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
$question = '';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
if(versionInUpdate($current_version, '0.9.16-svn1'))
{
$has_preconfig = true;
$description = 'Froxlor now features support for php-fpm.';
$question = '<strong>Do you want to enable php-fpm?:</strong>&nbsp;';
$question.= makeyesno('update_phpfpm_enabled', '1', '0', '0').'<br /><br />';
$question.= 'If \'yes\', please specify the configuration directory:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_configdir" value="/etc/php-fpm.d/" /><br /><br />';
$question.= 'Please specify the temporary files directory:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_tmpdir" value="/var/customers/tmp/" /><br /><br />';
$question.= 'Please specify the PEAR directory:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_peardir" value="/usr/share/php/:/usr/share/php5/" /><br /><br />';
$question.= 'Please specify the php-fpm restart-command:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_reload" value="/etc/init.d/php-fpm restart" /><br /><br />';
$question.= 'Please specify the php-fpm rocess manager control:&nbsp;';
$question.= '<select name="update_phpfpm_pm">';
$redirects = makeoption('static', 'static', 'static');
$redirects.= makeoption('dynamic', 'dynamic', 'static');
$question .= $redirects.'</select><br /><br />';
$question.= 'Please specify the number of child processes:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_max_children" value="1" /><br /><br />';
$question.= 'Please specify the number of requests per child before respawning:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_max_requests" value="0" /><br /><br />';
$question.= '<em>The following settings are only required if you chose process manager = dynamic</em><br /><br />';
$question.= 'Please specify the number of child processes created on startup:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_start_servers" value="20" /><br /><br />';
$question.= 'Please specify the desired minimum number of idle server processes:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_min_spare_servers" value="5" /><br /><br />';
$question.= 'Please specify the desired maximum number of idle server processes:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_max_spare_servers" value="35" /><br />';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
if(versionInUpdate($current_version, '0.9.16-svn2'))
{
if((int)$settings['phpfpm']['enabled'] == 1)
{
$has_preconfig = true;
$description = 'You can chose whether you want Froxlor to use PHP-FPM itself too now.';
$question = '<strong>Use PHP-FPM for the Froxlor Panel?:</strong>&nbsp;';
$question.= makeyesno('update_phpfpm_enabled_ownvhost', '1', '0', '0').'<br /><br />';
$question.= '<strong>If \'yes\', please specify local user/group (have to exist, Froxlor does not add them automatically):</strong><br /><br />';
$question.= 'Local user:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_httpuser" value="'.$settings['system']['mod_fcgid_httpuser'].'" /><br /><br />';
$question.= 'Local group:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_httpgroup" value="'.$settings['system']['mod_fcgid_httpgroup'].'" /><br />';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}
}

View File

@@ -43,9 +43,9 @@ if($settings['panel']['version'] == '1.0.10')
// Adding tables
$db->query("DROP TABLE IF EXISTS `" . TABLE_PANEL_HTACCESS . "`;");
$db->query("CREATE TABLE `" . TABLE_PANEL_HTACCESS . "` (" . " `id` int(11) unsigned NOT NULL auto_increment," . " `customerid` int(11) unsigned NOT NULL default '0'," . " `path` varchar(255) NOT NULL default ''," . " `options_indexes` tinyint(1) NOT NULL default '0'," . " PRIMARY KEY (`id`)" . ") TYPE=MyISAM ;");
$db->query("CREATE TABLE `" . TABLE_PANEL_HTACCESS . "` (" . " `id` int(11) unsigned NOT NULL auto_increment," . " `customerid` int(11) unsigned NOT NULL default '0'," . " `path` varchar(255) NOT NULL default ''," . " `options_indexes` tinyint(1) NOT NULL default '0'," . " PRIMARY KEY (`id`)" . ") ENGINE=MyISAM ;");
$db->query("DROP TABLE IF EXISTS `" . TABLE_PANEL_ADMINS . "`;");
$db->query("CREATE TABLE `" . TABLE_PANEL_ADMINS . "` (" . " `adminid` int(11) unsigned NOT NULL auto_increment," . " `loginname` varchar(50) NOT NULL default ''," . " `password` varchar(50) NOT NULL default ''," . " `name` varchar(255) NOT NULL default ''," . " `email` varchar(255) NOT NULL default ''," . " `customers` int(15) NOT NULL default '0'," . " `customers_used` int(15) NOT NULL default '0'," . " `customers_see_all` tinyint(1) NOT NULL default '0'," . " `domains` int(15) NOT NULL default '0'," . " `domains_used` int(15) NOT NULL default '0'," . " `domains_see_all` tinyint(1) NOT NULL default '0'," . " `change_serversettings` tinyint(1) NOT NULL default '0'," . " `diskspace` int(15) NOT NULL default '0'," . " `diskspace_used` int(15) NOT NULL default '0'," . " `mysqls` int(15) NOT NULL default '0'," . " `mysqls_used` int(15) NOT NULL default '0'," . " `emails` int(15) NOT NULL default '0'," . " `emails_used` int(15) NOT NULL default '0'," . " `email_forwarders` int(15) NOT NULL default '0'," . " `email_forwarders_used` int(15) NOT NULL default '0'," . " `ftps` int(15) NOT NULL default '0'," . " `ftps_used` int(15) NOT NULL default '0'," . " `subdomains` int(15) NOT NULL default '0'," . " `subdomains_used` int(15) NOT NULL default '0'," . " `traffic` int(15) NOT NULL default '0'," . " `traffic_used` int(15) NOT NULL default '0'," . " `deactivated` tinyint(1) NOT NULL default '0'," . " `lastlogin_succ` int(11) unsigned NOT NULL default '0'," . " `lastlogin_fail` int(11) unsigned NOT NULL default '0'," . " `loginfail_count` int(11) unsigned NOT NULL default '0'," . " PRIMARY KEY (`adminid`)" . ") TYPE=MyISAM ;");
$db->query("CREATE TABLE `" . TABLE_PANEL_ADMINS . "` (" . " `adminid` int(11) unsigned NOT NULL auto_increment," . " `loginname` varchar(50) NOT NULL default ''," . " `password` varchar(50) NOT NULL default ''," . " `name` varchar(255) NOT NULL default ''," . " `email` varchar(255) NOT NULL default ''," . " `customers` int(15) NOT NULL default '0'," . " `customers_used` int(15) NOT NULL default '0'," . " `customers_see_all` tinyint(1) NOT NULL default '0'," . " `domains` int(15) NOT NULL default '0'," . " `domains_used` int(15) NOT NULL default '0'," . " `domains_see_all` tinyint(1) NOT NULL default '0'," . " `change_serversettings` tinyint(1) NOT NULL default '0'," . " `diskspace` int(15) NOT NULL default '0'," . " `diskspace_used` int(15) NOT NULL default '0'," . " `mysqls` int(15) NOT NULL default '0'," . " `mysqls_used` int(15) NOT NULL default '0'," . " `emails` int(15) NOT NULL default '0'," . " `emails_used` int(15) NOT NULL default '0'," . " `email_forwarders` int(15) NOT NULL default '0'," . " `email_forwarders_used` int(15) NOT NULL default '0'," . " `ftps` int(15) NOT NULL default '0'," . " `ftps_used` int(15) NOT NULL default '0'," . " `subdomains` int(15) NOT NULL default '0'," . " `subdomains_used` int(15) NOT NULL default '0'," . " `traffic` int(15) NOT NULL default '0'," . " `traffic_used` int(15) NOT NULL default '0'," . " `deactivated` tinyint(1) NOT NULL default '0'," . " `lastlogin_succ` int(11) unsigned NOT NULL default '0'," . " `lastlogin_fail` int(11) unsigned NOT NULL default '0'," . " `loginfail_count` int(11) unsigned NOT NULL default '0'," . " PRIMARY KEY (`adminid`)" . ") ENGINE=MyISAM ;");
// Insert Admin user

View File

@@ -51,7 +51,7 @@ if($settings['panel']['version'] == '1.2.2-cvs1')
`language` varchar(30) NOT NULL default '',
`file` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM
) ENGINE=MyISAM
");
$db->query("INSERT INTO `" . TABLE_PANEL_LANGUAGE . "` (`id`, `language`, `file`) VALUES (1, 'Deutsch', 'lng/german.lng.php');");
$db->query("INSERT INTO `" . TABLE_PANEL_LANGUAGE . "` (`id`, `language`, `file`) VALUES (2, 'English', 'lng/english.lng.php');");
@@ -88,7 +88,7 @@ if($settings['panel']['version'] == '1.2.2-cvs3')
`id` int(11) unsigned NOT NULL auto_increment,
`file` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM
) ENGINE=MyISAM
");
$db->query("INSERT INTO `" . TABLE_PANEL_CRONSCRIPT . "` (`id`, `file`) VALUES (1, 'cron_traffic.php');");
$db->query("INSERT INTO `" . TABLE_PANEL_CRONSCRIPT . "` (`id`, `file`) VALUES (2, 'cron_tasks.php');");
@@ -146,7 +146,7 @@ if($settings['panel']['version'] == '1.2.3-cvs4')
PRIMARY KEY (`id`),
KEY `adminid` (`adminid`),
UNIQUE `date` (`adminid` , `year` , `month` , `day`)
) TYPE=MyISAM
) ENGINE=MyISAM
");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.2.3-cvs5' WHERE `settinggroup`='panel' AND `varname`='version'");
$settings['panel']['version'] = '1.2.3-cvs5';
@@ -267,7 +267,7 @@ if($settings['panel']['version'] == '1.2.6')
`value` longtext NOT NULL,
PRIMARY KEY (`id`),
KEY `adminid` (`adminid`)
) TYPE=MyISAM
) ENGINE=MyISAM
');
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.2.6-cvs1' WHERE `settinggroup`='panel' AND `varname`='version'");
$settings['panel']['version'] = '1.2.6-cvs1';
@@ -458,7 +458,7 @@ if($settings['panel']['version'] == '1.2.12-svn1')
`port` int(5) NOT NULL default \'80\',
`default` int(1) NOT NULL default \'0\',
PRIMARY KEY (`id`)
) TYPE=MyISAM');
) ENGINE=MyISAM');
$db->query('INSERT INTO `' . TABLE_PANEL_IPSANDPORTS . '` (`ip`, `port`, `default`) VALUES (\'' . $settings['system']['ipaddress'] . '\', \'80\', \'1\')');
$db->query('UPDATE `' . TABLE_PANEL_SETTINGS . '` SET `value` = \'1.2.12-svn2\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'');
$settings['panel']['version'] = '1.2.12-svn2';

View File

@@ -620,7 +620,7 @@ else
`mysql` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`)
) TYPE=MyISAM ;");
) ENGINE=MyISAM ;");
$db->query("CREATE TABLE `" . TABLE_PANEL_DISKSPACE_ADMINS . "` (
`id` int(11) unsigned NOT NULL auto_increment,
`adminid` int(11) unsigned NOT NULL default '0',
@@ -633,7 +633,7 @@ else
`mysql` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `adminid` (`adminid`)
) TYPE=MyISAM ;");
) ENGINE=MyISAM ;");
$db->query("INSERT INTO `" . TABLE_BILLING_SERVICE_CATEGORIES . "` (`id`, `category_name`, `category_order`, `category_classname`, `category_classfile`, `category_cachefield`, `category_caption`, `category_rowcaption_setup`, `category_rowcaption_interval`) VALUES (1, 'hosting', 10, 'hosting', 'lib/billing_class_hosting.php', 'invoice_fee_hosting', 'hosting_caption', 'hosting_rowcaption_setup', 'hosting_rowcaption_interval');");
$db->query("INSERT INTO `" . TABLE_BILLING_SERVICE_CATEGORIES . "` (`id`, `category_name`, `category_order`, `category_classname`, `category_classfile`, `category_cachefield`, `category_caption`, `category_rowcaption_setup`, `category_rowcaption_interval`) VALUES (2, 'domains', 20, 'domains', 'lib/billing_class_domains.php', 'invoice_fee_domains', 'domains_caption', 'domains_rowcaption_setup', 'domains_rowcaption_interval');");
$db->query("INSERT INTO `" . TABLE_BILLING_SERVICE_CATEGORIES . "` (`id`, `category_name`, `category_order`, `category_classname`, `category_classfile`, `category_cachefield`, `category_caption`, `category_rowcaption_setup`, `category_rowcaption_interval`) VALUES (3, 'traffic', 30, 'traffic', 'lib/billing_class_traffic.php', 'invoice_fee_traffic', 'traffic_caption', 'traffic_rowcaption_setup', 'traffic_rowcaption_interval');");

View File

@@ -0,0 +1,121 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Michael Kaufmann <mkaufmann@nutime.de>
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Cron
* @version $Id$
* @link http://www.nutime.de/
* @since 0.9.16
*
*/
class phpinterface
{
/**
* Database handler
* @var object
*/
private $_db = false;
/**
* Settings array
* @var array
*/
private $_settings = array();
/**
* Domain-Data array
* @var array
*/
private $_domain = array();
/**
* Interface object
* @var object
*/
private $_interface = null;
/**
* Admin-User data array
* @var array
*/
private $_admin_cache = array();
/**
* main constructor
*/
public function __construct($db, $settings, $domain)
{
$this->_db = $db;
$this->_settings = $settings;
$this->_domain = $domain;
$this->_setInterface();
}
/**
* returns the interface-object
* from where we can control it
*/
public function getInterface()
{
return $this->_interface;
}
/**
* set interface-object by type of
* php-interface: fcgid or php-fpm
* sets private $_interface variable
*/
private function _setInterface()
{
// php-fpm
if((int)$this->_settings['phpfpm']['enabled'] == 1)
{
$this->_interface = new phpinterface_fpm($this->_db, $this->_settings, $this->_domain);
}
elseif((int)$this->_settings['system']['mod_fcgid'] == 1)
{
$this->_interface = new phpinterface_fcgid($this->_db, $this->_settings, $this->_domain);
}
}
/**
* return the php-configuration from the database
*
* @param int $php_config_id id of the php-configuration
*
* @return array
*/
public function getPhpConfig($php_config_id)
{
$php_config_id = intval($php_config_id);
// If domain has no config, we will use the default one.
if($php_config_id == 0)
{
$php_config_id = 1;
}
if(!isset($this->php_configs_cache[$php_config_id]))
{
$this->_php_configs_cache[$php_config_id] = $this->_db->query_first(
"SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`
WHERE `id` = " . (int)$php_config_id
);
}
return $this->_php_configs_cache[$php_config_id];
}
}

View File

@@ -0,0 +1,291 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Michael Kaufmann <mkaufmann@nutime.de>
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Cron
* @version $Id$
* @link http://www.nutime.de/
* @since 0.9.16
*
*/
class phpinterface_fcgid
{
/**
* Database handler
* @var object
*/
private $_db = false;
/**
* Settings array
* @var array
*/
private $_settings = array();
/**
* Domain-Data array
* @var array
*/
private $_domain = array();
/**
* Admin-Date cache array
* @var array
*/
private $_admin_cache = array();
/**
* main constructor
*/
public function __construct($db, $settings, $domain)
{
$this->_db = $db;
$this->_settings = $settings;
$this->_domain = $domain;
}
public function createConfig($phpconfig)
{
// create starter
$starter_file = "#!/bin/sh\n\n";
$starter_file.= "#\n";
$starter_file.= "# starter created/changed on " . date("Y.m.d H:i:s") . " for domain '" . $this->_domain['domain'] . "' with id #" . $this->_domain['id'] . " from php template '" . $phpconfig['description'] . "' with id #" . $phpconfig['id'] . "\n";
$starter_file.= "# Do not change anything in this file, it will be overwritten by the Froxlor Cronjob!\n";
$starter_file.= "#\n\n";
$starter_file.= "umask 022\n";
$starter_file.= "PHPRC=" . escapeshellarg($this->getConfigDir()) . "\n";
$starter_file.= "export PHPRC\n";
// set number of processes for one domain
if((int)$this->_domain['mod_fcgid_starter'] != - 1)
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$$this->_domain['mod_fcgid_starter'] . "\n";
}
else
{
if((int)$phpconfig['mod_fcgid_starter'] != - 1)
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$phpconfig['mod_fcgid_starter'] . "\n";
}
else
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$this->_settings['system']['mod_fcgid_starter'] . "\n";
}
}
$starter_file.= "export PHP_FCGI_CHILDREN\n";
// set number of maximum requests for one domain
if((int)$this->_domain['mod_fcgid_maxrequests'] != - 1)
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$this->_domain['mod_fcgid_maxrequests'] . "\n";
}
else
{
if((int)$phpconfig['mod_fcgid_maxrequests'] != - 1)
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$phpconfig['mod_fcgid_maxrequests'] . "\n";
}
else
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$this->_settings['system']['mod_fcgid_maxrequests'] . "\n";
}
}
$starter_file.= "export PHP_FCGI_MAX_REQUESTS\n";
// Set Binary
$starter_file.= "exec " . $phpconfig['binary'] . " -c " . escapeshellarg($this->getConfigDir()) . "\n";
//remove +i attibute, so starter can be overwritten
if(file_exists($this->getStarterFile()))
{
removeImmutable($this->getStarterFile());
}
$starter_file_handler = fopen($this->getStarterFile(), 'w');
fwrite($starter_file_handler, $starter_file);
fclose($starter_file_handler);
safe_exec('chmod 750 ' . escapeshellarg($this->getStarterFile()));
safe_exec('chown ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($this->getStarterFile()));
setImmutable($this->getStarterFile());
}
public function createIniFile($phpconfig)
{
$openbasedir = '';
$openbasedirc = ';';
if($this->_domain['openbasedir'] == '1')
{
$openbasedirc = '';
$_phpappendopenbasedir = '';
$_custom_openbasedir = explode(':', $this->_settings['system']['mod_fcgid_peardir']);
foreach($_custom_openbasedir as $cobd)
{
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
}
$_custom_openbasedir = explode(':', $this->_settings['system']['phpappendopenbasedir']);
foreach($_custom_openbasedir as $cobd)
{
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
}
if($this->_domain['openbasedir_path'] == '0' && strstr($this->_domain['documentroot'], ":") === false)
{
$openbasedir = appendOpenBasedirPath($this->_domain['documentroot'], true);
}
else
{
$openbasedir = appendOpenBasedirPath($this->_domain['customerroot'], true);
}
$openbasedir .= appendOpenBasedirPath($this->getTempDir());
$openbasedir .= $_phpappendopenbasedir;
$openbasedir = explode(':', $openbasedir);
$clean_openbasedir = array();
foreach($openbasedir as $number => $path)
{
if(trim($path) != '/')
{
$clean_openbasedir[] = makeCorrectDir($path);
}
}
$openbasedir = implode(':', $clean_openbasedir);
}
else
{
$openbasedir = 'none';
$openbasedirc = ';';
}
$admin = $this->_getAdminData($this->_domain['adminid']);
$php_ini_variables = array(
'SAFE_MODE' => ($this->_domain['safemode'] == '0' ? 'Off' : 'On'),
'PEAR_DIR' => $this->_settings['system']['mod_fcgid_peardir'],
'OPEN_BASEDIR' => $openbasedir,
'OPEN_BASEDIR_C' => $openbasedirc,
'OPEN_BASEDIR_GLOBAL' => $this->_settings['system']['phpappendopenbasedir'],
'TMP_DIR' => $this->getTempDir(),
'CUSTOMER_EMAIL' => $this->_domain['email'],
'ADMIN_EMAIL' => $admin['email'],
'DOMAIN' => $this->_domain['domain'],
'CUSTOMER' => $this->_domain['loginname'],
'ADMIN' => $admin['loginname']
);
//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 domain '" . $this->_domain['domain'] . "' with id #" . $this->_domain['id'] . " 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($this->getIniFile(), 'w');
fwrite($phpini_file_handler, $phpini_file);
fclose($phpini_file_handler);
safe_exec('chown root:0 ' . escapeshellarg($this->getIniFile()));
safe_exec('chmod 0644 ' . escapeshellarg($this->getIniFile()));
}
/**
* fcgid-config directory
*
* @param boolean $createifnotexists create the directory if it does not exist
*
* @return string the directory
*/
public function getConfigDir($createifnotexists = true)
{
$configdir = makeCorrectDir($this->_settings['system']['mod_fcgid_configdir'] . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/');
if(!is_dir($configdir) && $createifnotexists)
{
safe_exec('mkdir -p ' . escapeshellarg($configdir));
safe_exec('chown ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($configdir));
}
return $configdir;
}
/**
* fcgid-temp directory
*
* @param boolean $createifnotexists create the directory if it does not exist
*
* @return string the directory
*/
public function getTempDir($createifnotexists = true)
{
$tmpdir = makeCorrectDir($this->_settings['system']['mod_fcgid_tmpdir'] . '/' . $this->_domain['loginname'] . '/');
if(!is_dir($tmpdir) && $createifnotexists)
{
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
safe_exec('chown -R ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($tmpdir));
safe_exec('chmod 0750 ' . escapeshellarg($tmpdir));
}
return $tmpdir;
}
/**
* return path of php-starter file
*
* @return string the directory
*/
public function getStarterFile()
{
$starter_filename = makeCorrectFile($this->getConfigDir() . '/php-fcgi-starter');
return $starter_filename;
}
/**
* return path of php.ini file
*
* @return string full with path file-name
*/
public function getIniFile()
{
$phpini_filename = makeCorrectFile($this->getConfigDir() . '/php.ini');
return $phpini_filename;
}
/**
* return the admin-data of a specific admin
*
* @param int $adminid id of the admin-user
*
* @return array
*/
private function _getAdminData($adminid)
{
$adminid = intval($adminid);
if(!isset($this->_admin_cache[$adminid]))
{
$this->_admin_cache[$adminid] = $this->_db->query_first(
"SELECT `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "`
WHERE `adminid` = " . (int)$adminid
);
}
return $this->_admin_cache[$adminid];
}
}

View File

@@ -0,0 +1,174 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Michael Kaufmann <mkaufmann@nutime.de>
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Cron
* @version $Id$
* @link http://www.nutime.de/
* @since 0.9.16
*
*/
class phpinterface_fpm
{
/**
* Database handler
* @var object
*/
private $_db = false;
/**
* Settings array
* @var array
*/
private $_settings = array();
/**
* Domain-Data array
* @var array
*/
private $_domain = array();
/**
* main constructor
*/
public function __construct($db, $settings, $domain)
{
$this->_db = $db;
$this->_settings = $settings;
$this->_domain = $domain;
}
public function createConfig($phpconfig)
{
$fh = @fopen($this->getConfigFile(), 'w');
if($fh)
{
$fpm_pm = $this->_settings['phpfpm']['pm'];
$fpm_children = (int)$this->_settings['phpfpm']['max_children'];
$fpm_start_servers = (int)$this->_settings['phpfpm']['start_servers'];
$fpm_min_spare_servers = (int)$this->_settings['phpfpm']['min_spare_servers'];
$fpm_max_spare_servers = (int)$this->_settings['phpfpm']['max_spare_servers'];
$fpm_requests = (int)$this->_settings['phpfpm']['max_requests'];
if($fpm_children == 0) {
$fpm_children = 1;
}
$fpm_config = ';PHP-FPM configuration for "'.$this->_domain['domain'].'" created on ' . date("Y.m.d H:i:s") . "\n";
$fpm_config.= '['.$this->_domain['domain'].']'."\n";
$fpm_config.= 'listen = '.$this->getSocketFile()."\n";
if($this->_domain['loginname'] == 'froxlor.panel')
{
$fpm_config.= 'listen.owner = '.$this->_domain['guid']."\n";
$fpm_config.= 'listen.group = '.$this->_domain['guid']."\n";
}
else
{
$fpm_config.= 'listen.owner = '.$this->_domain['loginname']."\n";
$fpm_config.= 'listen.group = '.$this->_domain['loginname']."\n";
}
$fpm_config.= 'listen.mode = 0666'."\n";
if($this->_domain['loginname'] == 'froxlor.panel')
{
$fpm_config.= 'user = '.$this->_domain['guid']."\n";
$fpm_config.= 'group = '.$this->_domain['guid']."\n";
}
else
{
$fpm_config.= 'user = '.$this->_domain['loginname']."\n";
$fpm_config.= 'group = '.$this->_domain['loginname']."\n";
}
$fpm_config.= 'pm = '.$fpm_pm."\n";
$fpm_config.= 'pm.max_children = '.$fpm_children."\n";
if($fpm_pm == 'dynamic') {
$fpm_config.= 'pm.start_servers = '.$fpm_start_servers."\n";
$fpm_config.= 'pm.min_spare_servers = '.$fpm_min_spare_servers."\n";
$fpm_config.= 'pm.max_spare_servers = '.$fpm_max_spare_servers."\n";
}
$fpm_config.= 'pm.max_requests = '.$fpm_requests."\n";
$fpm_config.= ';chroot = '.makeCorrectDir($this->_domain['documentroot'])."\n";
$tmpdir = makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/');
if(!is_dir($tmpdir))
{
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
}
//$slowlog = makeCorrectFile($this->_settings['system']['logfiles_directory'] . $this->_domain['loginname'] . '/php-fpm_slow.log');
$fpm_config.= 'env[TMP] = '.$tmpdir."\n";
$fpm_config.= 'env[TMPDIR] = '.$tmpdir."\n";
$fpm_config.= 'env[TEMP] = '.$tmpdir."\n";
$fpm_config.= 'php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f '.$this->_domain['email']."\n";
if($this->_domain['loginname'] != 'froxlor.panel')
{
$fpm_config.= 'php_admin_value[open_basedir] = ' . makeCorrectDir($this->_settings['system']['documentroot_prefix'] . '/' . $this->_domain['loginname'] . '/') .':' . makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/') . ':' . $this->_settings['phpfpm']['peardir'] . "\n";
}
$fpm_config.= 'php_admin_value[session.save_path] = ' . makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/') . "\n";
$fpm_config.= 'php_admin_value[upload_tmp_dir] = ' . makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/') . "\n";
fwrite($fh, $fpm_config, strlen($fpm_config));
fclose($fh);
}
}
public function createIniFile($phpconfig)
{
return;
}
/**
* fpm-config file
*
* @param boolean $createifnotexists create the directory if it does not exist
*
* @return string the full path to the file
*/
public function getConfigFile($createifnotexists = true)
{
$configdir = makeCorrectDir($this->_settings['phpfpm']['configdir']);
$config = makeCorrectFile($configdir.'/'.$this->_domain['domain'].'.conf');
if(!is_dir($configdir) && $createifnotexists)
{
safe_exec('mkdir -p ' . escapeshellarg($configdir));
}
return $config;
}
/**
* return path of fpm-socket file
*
* @param boolean $createifnotexists create the directory if it does not exist
*
* @return string the full path to the socket
*/
public function getSocketFile($createifnotexists = true)
{
$socketdir = makeCorrectDir('/var/run/'.$this->_settings['system']['webserver'].'/');
$socket = makeCorrectFile($socketdir.'/'.$this->_domain['loginname'].'-'.$this->_domain['domain'].'-php-fpm.socket');
if(!is_dir($socketdir) && $createifnotexists)
{
safe_exec('mkdir -p '.$socketdir);
safe_exec('chown -R '.$this->_settings['system']['httpuser'].':'.$this->_settings['system']['httpgroup'].' '.$socketdir);
}
return $socket;
}
}

View File

@@ -39,6 +39,12 @@ return Array(
'mkdir -p ' . $settings['system']['mod_fcgid_tmpdir'],
'chmod 1777 ' . $settings['system']['mod_fcgid_tmpdir']
),
'files' => ((int)$settings['phpfpm']['enabled'] == 1) ?
Array(
'etc_apache2_modules.d_70_fastcgi.conf' => '/etc/apache2/modules.d/70_fastcgi.conf'
)
:
null,
'restart' => Array(
'rc-update add apache2 default',
'/etc/init.d/apache2 restart'

View File

@@ -34,6 +34,12 @@ return Array(
'chmod 1777 ' . $settings['system']['mod_fcgid_tmpdir'],
'a2dismod userdir'
),
'files' => ((int)$settings['phpfpm']['enabled'] == 1) ?
Array(
'etc_apache2_mods-enabled_fastcgi.conf' => '/etc/apache2/mods-enabled/fastcgi.conf'
)
:
null,
'restart' => Array(
'/etc/init.d/apache2 restart'
)

View File

@@ -34,6 +34,12 @@ return Array(
'chmod 1777 ' . $settings['system']['mod_fcgid_tmpdir'],
'a2dismod userdir'
),
'files' => ((int)$settings['phpfpm']['enabled'] == 1) ?
Array(
'etc_apache2_mods-enabled_fastcgi.conf' => '/etc/apache2/mods-enabled/fastcgi.conf'
)
:
null,
'restart' => Array(
'/etc/init.d/apache2 restart'
),

View File

@@ -34,6 +34,12 @@ return Array(
'chmod 1777 ' . $settings['system']['mod_fcgid_tmpdir'],
'a2dismod userdir'
),
'files' => ((int)$settings['phpfpm']['enabled'] == 1) ?
Array(
'etc_apache2_mods-enabled_fastcgi.conf' => '/etc/apache2/mods-enabled/fastcgi.conf'
)
:
null,
'restart' => Array(
'/etc/init.d/apache2 restart'
),

View File

@@ -17,6 +17,7 @@
function buildFormEx($form, $part = '')
{
global $settings;
$fields = '';
if(validateFormDefinition($form))
@@ -34,24 +35,42 @@ function buildFormEx($form, $part = '')
// only show one section
elseif($part != '' && ($groupname == $part || $part == 'all'))
{
if(isset($groupdetails['title']) && $groupdetails['title'] != '')
/**
* this part checks for the 'websrv_avail' entry in the settings-array
* if found, we check if the current webserver is in the array. If this
* is not the case, we change the setting type to "hidden", #502
*/
$do_show = true;
if(isset($groupdetails['websrv_avail']) && is_array($groupdetails['websrv_avail']))
{
$fields .= getFormGroupOutput($groupname, $groupdetails);
}
if(validateFieldDefinition($groupdetails))
{
// Prefetch form fields
foreach($groupdetails['fields'] as $fieldname => $fielddetails)
$websrv = $settings['system']['webserver'];
if(!in_array($websrv, $groupdetails['websrv_avail']))
{
$groupdetails['fields'][$fieldname] = array_merge_prefix($fielddetails, $fielddetails['type'], prefetchFormFieldData($fieldname, $fielddetails));
$form['groups'][$groupname]['fields'][$fieldname] = $groupdetails['fields'][$fieldname];
$do_show = false;
}
// Collect form field output
foreach($groupdetails['fields'] as $fieldname => $fielddetails)
}
if($do_show)
{
if(isset($groupdetails['title']) && $groupdetails['title'] != '')
{
$fields .= getFormFieldOutput($fieldname, $fielddetails);
$fields .= getFormGroupOutput($groupname, $groupdetails);
}
if(validateFieldDefinition($groupdetails))
{
// Prefetch form fields
foreach($groupdetails['fields'] as $fieldname => $fielddetails)
{
$groupdetails['fields'][$fieldname] = array_merge_prefix($fielddetails, $fielddetails['type'], prefetchFormFieldData($fieldname, $fielddetails));
$form['groups'][$groupname]['fields'][$fieldname] = $groupdetails['fields'][$fieldname];
}
// Collect form field output
foreach($groupdetails['fields'] as $fieldname => $fielddetails)
{
$fields .= getFormFieldOutput($fieldname, $fielddetails);
}
}
}
}

View File

@@ -19,6 +19,8 @@
function getFormFieldOutput($fieldname, $fielddata)
{
global $settings;
$returnvalue = '';
if(is_array($fielddata) && isset($fielddata['type']) && $fielddata['type'] != '' && function_exists('getFormFieldOutput' . ucfirst($fielddata['type'])))
{
@@ -44,7 +46,26 @@ function getFormFieldOutput($fieldname, $fielddata)
$fielddata['value'] = null;
}
}
$returnvalue = call_user_func('getFormFieldOutput' . ucfirst($fielddata['type']), $fieldname, $fielddata);
/**
* this part checks for the 'websrv_avail' entry in the settings-array
* if found, we check if the current webserver is in the array. If this
* is not the case, we change the setting type to "hidden", #502
*/
$do_show = true;
if(isset($fielddata['websrv_avail']) && is_array($fielddata['websrv_avail']))
{
$websrv = $settings['system']['webserver'];
if(!in_array($websrv, $fielddata['websrv_avail']))
{
$do_show = false;
}
}
if($do_show)
{
$returnvalue = call_user_func('getFormFieldOutput' . ucfirst($fielddata['type']), $fieldname, $fielddata);
}
}
return $returnvalue;
}

View File

@@ -71,6 +71,24 @@ function getFormOverviewGroupOutput($groupname, $groupdetails)
}
}
eval("\$group = \"" . getTemplate("settings/settings_overviewgroup") . "\";");
/**
* this part checks for the 'websrv_avail' entry in the settings-array
* if found, we check if the current webserver is in the array. If this
* is not the case, we change the setting type to "hidden", #502
*/
$do_show = true;
if(isset($groupdetails['websrv_avail']) && is_array($groupdetails['websrv_avail']))
{
$websrv = $settings['system']['webserver'];
if(!in_array($websrv, $groupdetails['websrv_avail']))
{
$do_show = false;
}
}
if($do_show)
{
eval("\$group = \"" . getTemplate("settings/settings_overviewgroup") . "\";");
}
return $group;
}

View File

@@ -0,0 +1,44 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Functions
* @version $Id$
*/
function checkFcgidPhpFpm($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
{
global $settings;
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK);
/*
* check whether fcgid should be enabled but php-fpm is
*/
if($fieldname == 'system_mod_fcgid_enabled'
&& (int)$newfieldvalue == 1
&& (int)$settings['phpfpm']['enabled'] == 1
) {
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'phpfpmstillenabled');
}
/*
* check whether php-fpm should be enabled but fcgid is
*/
elseif($fieldname == 'system_phpfpm_enabled'
&& (int)$newfieldvalue == 1
&& (int)$settings['system']['mod_fcgid'] == 1
) {
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidstillenabled');
}
return $returnvalue;
}

View File

@@ -218,7 +218,14 @@ return array (
array (
'url' => 'admin_phpsettings.php?page=overview',
'label' => $lng['menue']['phpsettings']['maintitle'],
'show_element' => ( getSetting('system', 'mod_fcgid') == true ),
'show_element' => (
getSetting('system', 'mod_fcgid') == true
/*
* @TODO activate if phpfpm knows custom php.ini files
*
* || getSetting('phpfpm', 'enabled') == true
*/
),
),
),
),

View File

@@ -71,7 +71,7 @@ define('PACKAGE_ENABLED', 2);
// VERSION INFO
$version = '0.9.15';
$version = '0.9.16';
$dbversion = '2';
$branding = '';

File diff suppressed because it is too large Load Diff

View File

@@ -547,8 +547,8 @@ $lng['panel']['back'] = 'Back';
$lng['serversettings']['mod_log_sql']['title'] = 'Temporary save logs in the database';
$lng['serversettings']['mod_log_sql']['description'] = 'Use <a href="http://www.outoforder.cc/projects/apache/mod_log_sql/" title="mod_log_sql">mod_log_sql</a> to save webrequests temporarily<br /><b>This needs a special <a href="http://files.froxlor.org/docs/mod_log_sql/" title="mod_log_sql - documentation">apache-configuration</a>!</b>';
$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.<br/><b>This needs a special webserver configuration, see <a href="http://wiki.froxlor.org/contrib/fcgid-handbook">http://wiki.froxlor.org/contrib/fcgid-handbook</a></b><br /><br /><div style="color:red">NOTE: This folder\'s content gets deleted regulary so avoid storing data in there manually.</div>';
$lng['serversettings']['mod_fcgid']['title'] = 'Enable FCGID';
$lng['serversettings']['mod_fcgid']['description'] = 'Use this to run PHP with the corresponding useraccount.<br /><br /><b>This needs a special webserver configuration for Apache, see <a href="http://wiki.froxlor.org/contrib/fcgid-handbook">http://wiki.froxlor.org/contrib/fcgid-handbook</a></b>';
$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';
@@ -708,7 +708,7 @@ $lng['serversettings']['ticket']['noreply_name'] = 'Ticket e-mail sendername';
// ADDED IN 1.2.19-svn1
$lng['serversettings']['mod_fcgid']['configdir']['title'] = 'Configuration directory';
$lng['serversettings']['mod_fcgid']['configdir']['description'] = 'Where should all fcgid-configuration files be stored? If you don\'t use a self compiled suexec binary, which is the normal situation, this path must be under /var/www/';
$lng['serversettings']['mod_fcgid']['configdir']['description'] = 'Where should all fcgid-configuration files be stored? If you don\'t use a self compiled suexec binary, which is the normal situation, this path must be under /var/www/<br /><br /><div style="color:red">NOTE: This folder\'s content gets deleted regulary so avoid storing data in there manually.</div>';
$lng['serversettings']['mod_fcgid']['tmpdir']['title'] = 'Temp directory';
// ADDED IN 1.2.19-svn3
@@ -1442,7 +1442,7 @@ $lng['admin']['perlenabled'] = 'Perl enabled';
// ADDED IN FROXLOR 0.9.11-svn3
$lng['serversettings']['perl_path']['title'] = 'Path to perl';
$lng['serversettings']['perl_path']['description'] = 'Only relevant if you use lighttpd. Default is /usr/bin/perl';
$lng['serversettings']['perl_path']['description'] = 'Default is /usr/bin/perl';
// ADDED IN FROXLOR 0.9.12-svn1
$lng['admin']['fcgid_settings'] = 'FCGID';
@@ -1453,7 +1453,7 @@ $lng['admin']['mod_fcgid_group'] = 'Local group to use for FCGID (Froxlor vHost)
// ADDED IN FROXLOR 0.9.12-svn2
$lng['admin']['perl_settings'] = 'Perl/CGI';
$lng['serversettings']['perl']['suexecworkaround']['title'] = 'Enable SuExec workaround (Apache only)';
$lng['serversettings']['perl']['suexecworkaround']['title'] = 'Enable SuExec workaround';
$lng['serversettings']['perl']['suexecworkaround']['description'] = 'Enable only if customer docroots are not within the apache suexec path.<br />If enabled, Froxlor will generate a symlink from the customers perl-enabled directory + /cgi-bin/ to the given path.<br />Note that perl will then only work in the folders subdirectory /cgi-bin/ and not in the folder itself (as it does without this fix!)';
$lng['serversettings']['perl']['suexeccgipath']['title'] = 'Path for customer perl-enabled directory symlinks';
$lng['serversettings']['perl']['suexeccgipath']['description'] = 'You only need to set this if the SuExec-workaround is enabled.<br />ATTENTION: Be sure this path is within the suexec path or else this workaround is uselsess';
@@ -1517,8 +1517,33 @@ $lng['question']['customer_reallyunlock'] = 'Do you really want to unlock custom
// ADDED IN FROXLOR 0.9.15-svn1
$lng['serversettings']['perl_server']['title'] = 'Perl server location';
$lng['serversettings']['perl_server']['description'] = 'This is only used for Nginx<br />default is set for using the guide found at: http://wiki.nginx.org/SimpleCGI';
$lng['serversettings']['nginx_php_backend']['title'] = 'Nginx php backend';
$lng['serversettings']['perl_server']['description'] = 'Default is set for using the guide found at: http://wiki.nginx.org/SimpleCGI';
$lng['serversettings']['nginx_php_backend']['title'] = 'Nginx PHP backend';
$lng['serversettings']['nginx_php_backend']['description'] = 'this is where the PHP process is listening for requests from nginx, can be a unix socket of ip:port combination';
$lng['serversettings']['phpreload_command']['title'] = 'PHP reload command';
$lng['serversettings']['phpreload_command']['description'] = 'this is used to reload the Php backend if any is used (this is required to be set for Nginx) Default: Blank';
$lng['serversettings']['phpreload_command']['description'] = 'this is used to reload the PHP backend if any is used<br />Default: blank';
// ADDED IN FROXLOR 0.9.16
$lng['error']['intvaluetoolow'] = 'The given number is too low (field %s)';
$lng['error']['intvaluetoohigh'] = 'The given number is too high (field %s)';
$lng['admin']['phpfpm_settings'] = 'PHP-FPM';
$lng['serversettings']['phpfpm'] = 'Enable php-fpm';
$lng['serversettings']['phpfpm_settings']['configdir'] = 'Configuration directory of php-fpm';
$lng['serversettings']['phpfpm_settings']['reload'] = 'php-fpm restart command';
$lng['serversettings']['phpfpm_settings']['pm'] = 'Process manager control (pm)';
$lng['serversettings']['phpfpm_settings']['max_children']['title'] = 'The number of child processes';
$lng['serversettings']['phpfpm_settings']['max_children']['description'] = 'The number of child processes to be created when pm is set to \'static\' and the maximum number of child processes to be created when pm is set to \'dynamic\'<br />Equivalent to the PHP_FCGI_CHILDREN';
$lng['serversettings']['phpfpm_settings']['start_servers']['title'] = 'The number of child processes created on startup';
$lng['serversettings']['phpfpm_settings']['start_servers']['description'] = 'Note: Used only when pm is set to \'dynamic\'';
$lng['serversettings']['phpfpm_settings']['min_spare_servers']['title'] = 'The desired minimum number of idle server processes';
$lng['serversettings']['phpfpm_settings']['min_spare_servers']['description'] = 'Note: Used only when pm is set to \'dynamic\'<br />Note: Mandatory when pm is set to \'dynamic\'';
$lng['serversettings']['phpfpm_settings']['max_spare_servers']['title'] = 'The desired maximum number of idle server processes';
$lng['serversettings']['phpfpm_settings']['max_spare_servers']['description'] = 'Note: Used only when pm is set to \'dynamic\'<br />Note: Mandatory when pm is set to \'dynamic\'';
$lng['serversettings']['phpfpm_settings']['max_requests']['title'] = 'Requests per child before respawning';
$lng['serversettings']['phpfpm_settings']['max_requests']['description'] = 'For endless request processing specify \'0\'. Equivalent to PHP_FCGI_MAX_REQUESTS.';
$lng['error']['phpfpmstillenabled'] = 'PHP-FPM is currently active. Please deactivate it before activating FCGID';
$lng['error']['fcgidstillenabled'] = 'FCGID is currently active. Please deactivate it before activating PHP-FPM';
$lng['phpfpm']['vhost_httpuser'] = 'Local user to use for PHP-FPM (Froxlor vHost)';
$lng['phpfpm']['vhost_httpgroup'] = 'Local group to use for PHP-FPM (Froxlor vHost)';
$lng['phpfpm']['ownvhost']['title'] = 'Enable PHP-FPM for the Froxlor vHost';
$lng['phpfpm']['ownvhost']['description'] = 'If enabled, Froxlor will also be running under a local user';

View File

@@ -547,7 +547,7 @@ $lng['panel']['back'] = 'Zur&uuml;ck';
$lng['serversettings']['mod_log_sql']['title'] = 'Logs in Datenbank zwischenspeichern';
$lng['serversettings']['mod_log_sql']['description'] = '<a href="http://www.outoforder.cc/projects/apache/mod_log_sql/" title="mod_log_sql">mod_log_sql</a> benutzen um die Webzugriffe tempor&auml;r zu speichern<br /><b>Dies ben&ouml;tigt eine spezielle Apache-Konfiguration</b>';
$lng['serversettings']['mod_fcgid']['title'] = 'PHP &uuml;ber mod_fcgid/suexec einbinden';
$lng['serversettings']['mod_fcgid']['description'] = 'mod_fcgid/suexec/libnss_mysql benutzen um PHP unter dem jeweiligen Useraccount laufen zu lassen<br /><b>Dies ben&ouml;tigt eine spezielle <a href="http://files.froxlor.org/docs/mod_log_sql/" title="mod_log_sql - Dokumentation">Apache-Konfiguration</a></b><br /><br /><div style="color:red">ACHTUNG: Der Inhalt dieses Ordners wird regelm&auml;&szlig;ig geleert, daher sollten keinerlei Daten dort manuell abgelegt werden.</div>';
$lng['serversettings']['mod_fcgid']['description'] = 'PHP unter dem jeweiligen Useraccount laufen lassen.<br /><br /><b>Dies ben&ouml;tigt eine spezielle Webserver-Konfiguration f&uuml;r Apache, siehe <a href="http://wiki.froxlor.org/contrib/fcgid-handbook">http://wiki.froxlor.org/contrib/fcgid-handbook</a>.</b>';
$lng['serversettings']['sendalternativemail']['title'] = 'Alternative E-Mail-Adresse benutzen';
$lng['serversettings']['sendalternativemail']['description'] = 'W&auml;hrend des Erstellens eines Accounts das Passwort an eine andere E-Mail-Adresse senden';
$lng['emails']['alternative_emailaddress'] = 'Alternative E-Mail-Adresse';
@@ -578,7 +578,6 @@ $lng['serversettings']['mysql_access_host']['description'] = 'Eine durch Komma g
// CHANGED IN 1.2.18
$lng['serversettings']['mod_log_sql']['description'] = '<a href="http://www.outoforder.cc/projects/apache/mod_log_sql/" title="mod_log_sql">mod_log_sql</a> benutzen um die Webzugriffe tempor&auml;r zu speichern<br /><b>Dies ben&ouml;tigt eine spezielle <a href="http://files.froxlor.org/docs/mod_log_sql/" title="mod_log_sql - Dokumentation">Apache-Konfiguration</a></b>';
$lng['serversettings']['mod_fcgid']['description'] = 'mod_fcgid/suexec/libnss_mysql benutzen um PHP unter dem jeweiligen Useraccount laufen zu lassen<br /><b>Dies ben&ouml;tigt eine spezielle Webserver-Konfiguration, siehe <a href="http://wiki.froxlor.org/contrib/fcgid-handbook">http://wiki.froxlor.org/contrib/fcgid-handbook</a>.</b>';
// ADDED IN 1.2.18-svn1
@@ -712,7 +711,7 @@ $lng['serversettings']['ticket']['noreply_name'] = 'Ticket E-Mail Absendername';
// ADDED IN 1.2.19-svn
$lng['serversettings']['mod_fcgid']['configdir']['title'] = 'Konfigurations-Verzeichnis';
$lng['serversettings']['mod_fcgid']['configdir']['description'] = 'Wo sollen alle Konfigurationsdateien von fcgid liegen? Wenn Sie keine selbst kompilierte suexec Binary benutzen, was in der Regel der Fall ist, muss dieser Pfad unter /var/www/ liegen.';
$lng['serversettings']['mod_fcgid']['configdir']['description'] = 'Wo sollen alle Konfigurationsdateien von fcgid liegen? Wenn Sie keine selbst kompilierte suexec Binary benutzen, was in der Regel der Fall ist, muss dieser Pfad unter /var/www/ liegen.<br /><br /><div style="color:red">ACHTUNG: Der Inhalt dieses Ordners wird regelm&auml;&szlig;ig geleert, daher sollten keinerlei Daten dort manuell abgelegt werden.</div>';
$lng['serversettings']['mod_fcgid']['tmpdir']['title'] = 'Tempor&auml;res Verzeichnis';
// ADDED IN 1.2.19-svn3
@@ -1425,7 +1424,7 @@ $lng['admin']['perlenabled'] = 'Perl verf&uuml;gbar';
// ADDED IN FROXLOR 0.9.11-svn3
$lng['serversettings']['perl_path']['title'] = 'Pfad zu Perl';
$lng['serversettings']['perl_path']['description'] = 'Nur n&ouml;tig f&uuml;r lighttpd-Nutzer. Standard ist /usr/bin/perl';
$lng['serversettings']['perl_path']['description'] = 'Standard ist /usr/bin/perl';
// ADDED IN FROXLOR 0.9.12-svn1
$lng['admin']['fcgid_settings'] = 'FCGID';
@@ -1436,7 +1435,7 @@ $lng['admin']['mod_fcgid_group'] = 'Lokale Gruppe f&uuml;r FCGID (Froxlor Vhost)
// ADDED IN FROXLOR 0.9.12-svn2
$lng['admin']['perl_settings'] = 'Perl/CGI';
$lng['serversettings']['perl']['suexecworkaround']['title'] = 'Aktiviere SuExec Workaround (nur f&uuml;r Apache)';
$lng['serversettings']['perl']['suexecworkaround']['title'] = 'Aktiviere SuExec Workaround';
$lng['serversettings']['perl']['suexecworkaround']['description'] = 'Aktivieren Sie den Workaround nur, wenn die Kunden-Heimatverzeichnisse sich nicht unterhalb des suexec-Pfades liegen.<br />Wenn aktiviert erstellt Froxlor eine Verkn&uuml;pfung des vom Kunden f&uuml;r Perl aktiviertem Pfad + /cgi-bin/ im angegebenen suexec-Pfad.<br />Bitte beachten Sie, dass Perl dann nur im Unterordner /cgi-bin/ des Kunden-Ordners funktioniert und nicht direkt in diesem Ordner (wie es ohne den Workaround w&auml;re!)';
$lng['serversettings']['perl']['suexeccgipath']['title'] = 'Pfad f&uuml;r Verkn&uuml;pfungen zu Kunden-Perl-Verzeichnis';
$lng['serversettings']['perl']['suexeccgipath']['description'] = 'Diese Einstellung wird nur ben&ouml;tigt, wenn der SuExec-Workaround aktiviert ist.<br />ACHTUNG: Stellen Sie sicher, dass sich der angegebene Pfad innerhalb des Suexec-Pfades befindet ansonsten ist der Workaround nutzlos';
@@ -1500,8 +1499,33 @@ $lng['question']['customer_reallyunlock'] = 'Wollen Sie den Kunden %s wirklich e
// ADDED IN FROXLOR 0.9.15-svn1
$lng['serversettings']['perl_server']['title'] = 'Perl Server Ort';
$lng['serversettings']['perl_server']['description'] = 'Nur f&uuml;r nginx<br />Der Standardwert ist diesem Guide entnommen: http://wiki.nginx.org/SimpleCGI';
$lng['serversettings']['perl_server']['description'] = 'Der Standardwert ist diesem Guide entnommen: http://wiki.nginx.org/SimpleCGI';
$lng['serversettings']['nginx_php_backend']['title'] = 'Nginx PHP Backend';
$lng['serversettings']['nginx_php_backend']['description'] = 'Dies ist das Backend, auf dem PHP auf Anfragen von Nginx h&ouml;rt. Kann ein UNIX Socket oder eine IP:Port Kombination sein';
$lng['serversettings']['phpreload_command']['title'] = 'PHP Reload Befehl';
$lng['serversettings']['phpreload_command']['description'] = 'Dieser wird ben&ouml;tigt, um das PHP Backend f&uuml;r Nginx bei Bedarf durch den Cronjob neu zu laden. (Nur f&uuml;r Nginx, Standard: leer)';
$lng['serversettings']['phpreload_command']['description'] = 'Dieser wird ben&ouml;tigt, um das PHP Backend bei Bedarf durch den Cronjob neu zu laden. (Standard: leer)';
// ADDED IN FROXLOR 0.9.16
$lng['error']['intvaluetoolow'] = 'Die angegebene Zahl ist zu klein (Feld %s)';
$lng['error']['intvaluetoohigh'] = 'Die angegebene Zahl ist zu gro&szlig; (Feld %s)';
$lng['admin']['phpfpm_settings'] = 'PHP-FPM';
$lng['serversettings']['phpfpm'] = 'Aktiviere php-fpm';
$lng['serversettings']['phpfpm_settings']['configdir'] = 'Pfad zu php-fpm Konfigurationen';
$lng['serversettings']['phpfpm_settings']['reload'] = 'Kommando zum Neustarten von php-fpm';
$lng['serversettings']['phpfpm_settings']['pm'] = 'Prozess Manager Control (PM)';
$lng['serversettings']['phpfpm_settings']['max_children']['title'] = 'Anzahl der Kind-Prozesse';
$lng['serversettings']['phpfpm_settings']['max_children']['description'] = 'Die Anzahl der zu startenden Kind-Prozesse wenn PM auf \'static\' steht und die maximale Anzahl der Prozesse wenn PM auf \'dynamic\' steht.<br />Equivalent zu PHP_FCGI_CHILDREN';
$lng['serversettings']['phpfpm_settings']['start_servers']['title'] = 'Anzahl der beim Starten zu erstellenden Kind-Prozesse';
$lng['serversettings']['phpfpm_settings']['start_servers']['description'] = 'Hinweis: Nur wenn PM auf \'dynamic\' steht';
$lng['serversettings']['phpfpm_settings']['min_spare_servers']['title'] = 'Mindestanzahl der Idle-Prozesse';
$lng['serversettings']['phpfpm_settings']['min_spare_servers']['description'] = 'Hinweis: Nur wenn PM auf \'dynamic\' steht<br />Wichtig: Pflichtangabe wenn PM auf \'dynamic\' steht';
$lng['serversettings']['phpfpm_settings']['max_spare_servers']['title'] = 'Maximale Anzahl der Idle-Prozesse';
$lng['serversettings']['phpfpm_settings']['max_spare_servers']['description'] = 'Hinweis: Nur wenn PM auf \'dynamic\' steht<br />Wichtig: Pflichtangabe wenn PM auf \'dynamic\' steht';
$lng['serversettings']['phpfpm_settings']['max_requests']['title'] = 'Requests pro Kindprozess bevor Neuerstellung (respawning)';
$lng['serversettings']['phpfpm_settings']['max_requests']['description'] = 'F&uuml;r keine Begrenzung \'0\' angeben. Equivalent zu PHP_FCGI_MAX_REQUESTS.';
$lng['error']['phpfpmstillenabled'] = 'PHP-FPM ist derzeit aktiviert. Bitte deaktiviere es, um FCGID zu aktivieren';
$lng['error']['fcgidstillenabled'] = 'FCGID ist derzeit aktiviert. Bitte deaktiviere es, um PHP-FPM zu aktivieren';
$lng['phpfpm']['vhost_httpuser'] = 'Lokaler Benutzer f&uuml;r PHP-FPM (Froxlor Vhost)';
$lng['phpfpm']['vhost_httpgroup'] = 'Lokale Gruppe f&uuml;r PHP-FPM (Froxlor Vhost)';
$lng['phpfpm']['ownvhost']['title'] = 'Verwende PHP-FPM im Froxlor Vhost';
$lng['phpfpm']['ownvhost']['description'] = 'Wenn verwendet, wird Froxlor selbst unter einem lokalem Benutzer ausgef&uuml;hrt';

View File

@@ -57,6 +57,12 @@ class apache
public function reload()
{
if((int)$this->settings['phpfpm']['enabled'] == 1)
{
fwrite($this->debugHandler, ' apache::reload: reloading php-fpm' . "\n");
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'reloading php-fpm');
safe_exec(escapeshellcmd($this->settings['phpfpm']['reload']));
}
fwrite($this->debugHandler, ' apache::reload: reloading apache' . "\n");
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'reloading apache');
safe_exec(escapeshellcmd($this->settings['system']['apachereload_command']));
@@ -76,9 +82,10 @@ class apache
}
$vhosts_filename = makeCorrectFile($vhosts_folder . '/05_froxlor_dirfix_nofcgid.conf');
if($this->settings['system']['mod_fcgid'] == '1')
{
// if we use fcgid we don't need this file
if($this->settings['system']['mod_fcgid'] == '1'
|| $this->settings['phpfpm']['enabled'] == '1'
) {
// if we use fcgid or php-fpm we don't need this file
if(file_exists($vhosts_filename))
{
fwrite($this->debugHandler, ' apache::_createStandardDirectoryEntry: unlinking ' . basename($vhosts_filename) . "\n");
@@ -220,7 +227,7 @@ class apache
if($this->settings['system']['mod_fcgid_ownvhost'] == '1')
{
$configdir = makeCorrectDir($this->settings['system']['mod_fcgid_configdir'] . '/froxlor.panel/');
$configdir = makeCorrectDir($this->settings['system']['mod_fcgid_configdir'] . '/froxlor.panel/' . $this->settings['system']['hostname']);
if((int)$this->settings['system']['mod_fcgid_wrapper'] == 0)
{
$this->virtualhosts_data[$vhosts_filename].= ' SuexecUserGroup "' . $this->settings['system']['mod_fcgid_httpuser'] . '" "' . $this->settings['system']['mod_fcgid_httpgroup'] . '"' . "\n";
@@ -239,6 +246,35 @@ class apache
$this->virtualhosts_data[$vhosts_filename].= ' </Directory>' . "\n";
}
}
// create php-fpm <Directory>-Part (config is created in apache_fcgid)
elseif($this->settings['phpfpm']['enabled'] == '1')
{
$domain = array(
'id' => 'none',
'domain' => $this->settings['system']['hostname'],
'adminid' => 1, /* first admin-user (superadmin) */
'mod_fcgid_starter' => -1,
'mod_fcgid_maxrequests' => -1,
'guid' => $this->settings['phpfpm']['vhost_httpuser'],
'openbasedir' => 0,
'safemode' => '0',
'email' => $this->settings['panel']['adminmail'],
'loginname' => 'froxlor.panel',
'documentroot' => $mypath
);
$php = new phpinterface($this->getDB(), $this->settings, $domain);
$this->virtualhosts_data[$vhosts_filename].= ' SuexecUserGroup "' . $this->settings['system']['mod_fcgid_httpuser'] . '" "' . $this->settings['system']['mod_fcgid_httpgroup'] . '"' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' FastCgiExternalServer ' . $mypath . 'fpm.external -socket ' . $php->getInterface()->getSocketFile() . ' -user ' . $this->settings['system']['mod_fcgid_httpuser'] . ' -group ' . $this->settings['system']['mod_fcgid_httpuser'] . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' <Directory "' . $mypath . '">' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' AddHandler php5-fastcgi .php'. "\n";
$this->virtualhosts_data[$vhosts_filename].= ' Action php5-fastcgi /fastcgiphp' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' Options +ExecCGI' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' Order allow,deny' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' allow from all' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' </Directory>' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' Alias /fastcgiphp ' . $mypath . 'fpm.external' . "\n";
}
/**
* dirprotection, see #72
@@ -1089,6 +1125,11 @@ class apache
$this->wipeOutOldDiroptionConfigs();
}
}
else
{
// no more diroptions, but there might be some file-corpses which have to be removed
$this->wipeOutOldDiroptionConfigs();
}
// Write htpasswds
@@ -1124,6 +1165,11 @@ class apache
$this->logger->logAction(CRON_ACTION, LOG_WARNING, 'WARNING!!! ' . $this->settings['system']['apacheconf_htpasswddir'] . ' is not a directory. htpasswd directory protection is disabled!!!');
}
}
else
{
// no more htpasswds, but there might be some file-corpses which have to be removed
$this->wipeOutOldHtpasswdConfigs();
}
// Write virtualhosts

View File

@@ -26,219 +26,58 @@ if(@php_sapi_name() != 'cli'
class apache_fcgid extends apache
{
private $php_configs_cache = array();
private $admin_cache = array();
/*
* We put together the needed php options in the virtualhost entries
*/
protected function composePhpOptions($domain)
{
$php_options_text = '';
if($domain['phpenabled'] == '1')
{
// This vHost has PHP enabled and we are using mod_fcgid
//create basic variables for config
$php = new phpinterface($this->getDB(), $this->settings, $domain);
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
$configdir = makeCorrectDir($this->settings['system']['mod_fcgid_configdir'] . '/' . $domain['loginname'] . '/' . $domain['domain'] . '/');
$starter_filename = makeCorrectFile($configdir . '/php-fcgi-starter');
$phpini_filename = makeCorrectFile($configdir . '/php.ini');
$tmpdir = makeCorrectDir($this->settings['system']['mod_fcgid_tmpdir'] . '/' . $domain['loginname'] . '/');
// create config dir if necessary
if(!is_dir($configdir))
{
safe_exec('mkdir -p ' . escapeshellarg($configdir));
safe_exec('chown ' . $domain['guid'] . ':' . $domain['guid'] . ' ' . escapeshellarg($configdir));
}
// create tmp dir if necessary
if(!is_dir($tmpdir))
{
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
safe_exec('chown -R ' . $domain['guid'] . ':' . $domain['guid'] . ' ' . escapeshellarg($tmpdir));
safe_exec('chmod 0750 ' . escapeshellarg($tmpdir));
}
// Load php config
$phpconfig = $this->getPhpConfig((int)$domain['phpsettingid']);
if((int)$this->settings['system']['mod_fcgid_wrapper'] == 0)
if((int)$this->settings['phpfpm']['enabled'] == 1)
{
$php_options_text.= ' SuexecUserGroup "' . $domain['loginname'] . '" "' . $domain['loginname'] . '"' . "\n";
$php_options_text.= ' ScriptAlias /php/ ' . $configdir . "\n";
}
else
{
$php_options_text.= ' SuexecUserGroup "' . $domain['loginname'] . '" "' . $domain['loginname'] . '"' . "\n";
$php_options_text.= ' <Directory "' . $domain['documentroot'] . '">' . "\n";
$file_extensions = explode(' ', $phpconfig['file_extensions']);
$php_options_text.= ' AddHandler fcgid-script .' . implode(' .', $file_extensions) . "\n";
foreach($file_extensions as $file_extension)
{
$php_options_text.= ' FCGIWrapper ' . $starter_filename . ' .' . $file_extension . "\n";
}
$php_options_text.= ' FastCgiExternalServer ' . makeCorrectDir($domain['documentroot']) . 'fpm.external -socket ' . $php->getInterface()->getSocketFile() . ' -user ' . $domain['loginname'] . ' -group ' . $domain['loginname'] . "\n";
$php_options_text.= ' <Directory "' . makeCorrectDir($domain['documentroot']) . '">' . "\n";
$php_options_text.= ' AddHandler php5-fastcgi .php'. "\n";
$php_options_text.= ' Action php5-fastcgi /fastcgiphp' . "\n";
$php_options_text.= ' Options +ExecCGI' . "\n";
$php_options_text.= ' Order allow,deny' . "\n";
$php_options_text.= ' allow from all' . "\n";
$php_options_text.= ' </Directory>' . "\n";
}
// create starter
$starter_file = "#!/bin/sh\n\n";
$starter_file.= "#\n";
$starter_file.= "# starter created/changed on " . date("Y.m.d H:i:s") . " for domain '" . $domain['domain'] . "' with id #" . $domain['id'] . " from php template '" . $phpconfig['description'] . "' with id #" . $phpconfig['id'] . "\n";
$starter_file.= "# Do not change anything in this file, it will be overwritten by the Froxlor Cronjob!\n";
$starter_file.= "#\n\n";
$starter_file.= "umask 022\n";
$starter_file.= "PHPRC=" . escapeshellarg($configdir) . "\n";
$starter_file.= "export PHPRC\n";
// set number of processes for one domain
if((int)$domain['mod_fcgid_starter'] != - 1)
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$domain['mod_fcgid_starter'] . "\n";
$php_options_text.= ' Alias /fastcgiphp ' . makeCorrectDir($domain['documentroot']) . 'fpm.external' . "\n";
}
else
{
if((int)$phpconfig['mod_fcgid_starter'] != - 1)
if((int)$this->settings['system']['mod_fcgid_wrapper'] == 0)
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$phpconfig['mod_fcgid_starter'] . "\n";
$php_options_text.= ' SuexecUserGroup "' . $domain['loginname'] . '" "' . $domain['loginname'] . '"' . "\n";
$php_options_text.= ' ScriptAlias /php/ ' . $php->getInterface()->getConfigDir() . "\n";
}
else
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$this->settings['system']['mod_fcgid_starter'] . "\n";
}
}
$starter_file.= "export PHP_FCGI_CHILDREN\n";
// set number of maximum requests for one domain
if((int)$domain['mod_fcgid_maxrequests'] != - 1)
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$domain['mod_fcgid_maxrequests'] . "\n";
}
else
{
if((int)$phpconfig['mod_fcgid_maxrequests'] != - 1)
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$phpconfig['mod_fcgid_maxrequests'] . "\n";
}
else
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$this->settings['system']['mod_fcgid_maxrequests'] . "\n";
}
}
$starter_file.= "export PHP_FCGI_MAX_REQUESTS\n";
// Set Binary
$starter_file.= "exec " . $phpconfig['binary'] . " -c " . escapeshellarg($configdir) . "\n";
//remove +i attibute, so starter can be overwritten
if(file_exists($starter_filename))
{
removeImmutable($starter_filename);
}
$starter_file_handler = fopen($starter_filename, 'w');
fwrite($starter_file_handler, $starter_file);
fclose($starter_file_handler);
safe_exec('chmod 750 ' . escapeshellarg($starter_filename));
safe_exec('chown ' . $domain['guid'] . ':' . $domain['guid'] . ' ' . escapeshellarg($starter_filename));
setImmutable($starter_filename);
// define the php.ini
$openbasedir = '';
$openbasedirc = ';';
if($domain['openbasedir'] == '1')
{
$openbasedirc = '';
$_phpappendopenbasedir = '';
$_custom_openbasedir = explode(':', $this->settings['system']['mod_fcgid_peardir']);
foreach($_custom_openbasedir as $cobd)
{
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
}
$_custom_openbasedir = explode(':', $this->settings['system']['phpappendopenbasedir']);
foreach($_custom_openbasedir as $cobd)
{
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
}
if($domain['openbasedir_path'] == '0' && strstr($domain['documentroot'], ":") === false)
{
$openbasedir = appendOpenBasedirPath($domain['documentroot'], true);
}
else
{
$openbasedir = appendOpenBasedirPath($domain['customerroot'], true);
}
$openbasedir .= appendOpenBasedirPath($tmpdir);
$openbasedir .= $_phpappendopenbasedir;
$openbasedir = explode(':', $openbasedir);
$clean_openbasedir = array();
foreach($openbasedir as $number => $path)
{
if(trim($path) != '/')
$php_options_text.= ' SuexecUserGroup "' . $domain['loginname'] . '" "' . $domain['loginname'] . '"' . "\n";
$php_options_text.= ' <Directory "' . $domain['documentroot'] . '">' . "\n";
$file_extensions = explode(' ', $phpconfig['file_extensions']);
$php_options_text.= ' AddHandler fcgid-script .' . implode(' .', $file_extensions) . "\n";
foreach($file_extensions as $file_extension)
{
$clean_openbasedir[] = makeCorrectDir($path);
$php_options_text.= ' FCGIWrapper ' . $php->getInterface()->getStarterFile() . ' .' . $file_extension . "\n";
}
$php_options_text.= ' Options +ExecCGI' . "\n";
$php_options_text.= ' Order allow,deny' . "\n";
$php_options_text.= ' allow from all' . "\n";
$php_options_text.= ' </Directory>' . "\n";
}
$openbasedir = implode(':', $clean_openbasedir);
}
else
{
$openbasedir = 'none';
$openbasedirc = ';';
}
$admin = $this->getAdminData($domain['adminid']);
$php_ini_variables = array(
'SAFE_MODE' => ($domain['safemode'] == '0' ? 'Off' : 'On'),
'PEAR_DIR' => $this->settings['system']['mod_fcgid_peardir'],
'OPEN_BASEDIR' => $openbasedir,
'OPEN_BASEDIR_C' => $openbasedirc,
'OPEN_BASEDIR_GLOBAL' => $this->settings['system']['phpappendopenbasedir'],
'TMP_DIR' => $tmpdir,
'CUSTOMER_EMAIL' => $domain['email'],
'ADMIN_EMAIL' => $admin['email'],
'DOMAIN' => $domain['domain'],
'CUSTOMER' => $domain['loginname'],
'ADMIN' => $admin['loginname']
);
//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 domain '" . $domain['domain'] . "' with id #" . $domain['id'] . " 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));
// create starter-file | config-file
$php->getInterface()->createConfig($phpconfig);
// create php.ini
// @TODO make php-fpm support this
$php->getInterface()->createIniFile($phpconfig);
}
else
{
@@ -248,149 +87,56 @@ class apache_fcgid extends apache
return $php_options_text;
}
private function getPhpConfig($php_config_id)
{
$php_config_id = intval($php_config_id);
// If domain has no config, we will use the default one.
if($php_config_id == 0)
{
$php_config_id = 1;
}
if(!isset($this->php_configs_cache[$php_config_id]))
{
$this->php_configs_cache[$php_config_id] = $this->getDB()->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$php_config_id);
}
return $this->php_configs_cache[$php_config_id];
}
private function getAdminData($adminid)
{
$adminid = intval($adminid);
if(!isset($this->admin_cache[$adminid]))
{
$this->admin_cache[$adminid] = $this->getDB()->query_first("SELECT `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = " . (int)$adminid);
}
return $this->admin_cache[$adminid];
}
public function createOwnVhostStarter()
{
if ($this->settings['system']['mod_fcgid_ownvhost'] == '1')
{
if ($this->settings['system']['mod_fcgid_ownvhost'] == '1'
|| ($this->settings['phpfpm']['enabled'] == '1'
&& $this->settings['phpfpm']['enabled_ownvhost'] == '1')
) {
$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'];
$group = $this->settings['system']['mod_fcgid_httpgroup'];
if ($this->settings['system']['mod_fcgid_ownvhost'] == '1')
{
$user = $this->settings['system']['mod_fcgid_httpuser'];
$group = $this->settings['system']['mod_fcgid_httpgroup'];
}
elseif($this->settings['phpfpm']['enabled'] == '1'
&& $this->settings['phpfpm']['enabled_ownvhost'] == '1'
) {
$user = $this->settings['phpfpm']['vhost_httpuser'];
$group = $this->settings['phpfpm']['vhost_httpgroup'];
}
$domain = array(
'id' => 'none',
'domain' => $this->settings['system']['hostname'],
'adminid' => 1, /* first admin-user (superadmin) */
'mod_fcgid_starter' => -1,
'mod_fcgid_maxrequests' => -1,
'guid' => $user,
'openbasedir' => 0,
'safemode' => '0',
'email' => $this->settings['panel']['adminmail'],
'loginname' => 'froxlor.panel',
'documentroot' => $mypath
);
// all the files and folders have to belong to the local user
// now because we also use fcgid for our own vhost
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
// create config dir if necessary
if(!is_dir($configdir))
{
safe_exec('mkdir -p ' . escapeshellarg($configdir));
safe_exec('chown ' . $user . ':' . $group . ' ' . escapeshellarg($configdir));
}
// create tmp dir if necessary
if(!is_dir($tmpdir))
{
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($tmpdir));
safe_exec('chmod 0750 ' . escapeshellarg($tmpdir));
}
// get php.ini for our own vhost
$phpconfig = $this->getPhpConfig((int)$this->settings['system']['mod_fcgid_defaultini_ownvhost']);
$php = new phpinterface($this->getDB(), $this->settings, $domain);
// create starter
$starter_file = "#!/bin/sh\n\n";
$starter_file.= "#\n";
$starter_file.= "# starter created/changed on " . date("Y.m.d H:i:s") . " for the Froxlor vhost\n";
$starter_file.= "# Do not change anything in this file, it will be overwritten by the Froxlor Cronjob!\n";
$starter_file.= "#\n\n";
$starter_file.= "umask 022\n";
$starter_file.= "PHPRC=" . escapeshellarg($configdir) . "\n";
$starter_file.= "export PHPRC\n";
if((int)$phpconfig['mod_fcgid_starter'] != - 1)
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$phpconfig['mod_fcgid_starter'] . "\n";
}
else
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$this->settings['system']['mod_fcgid_starter'] . "\n";
}
$starter_file.= "export PHP_FCGI_CHILDREN\n";
if((int)$phpconfig['mod_fcgid_maxrequests'] != - 1)
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$phpconfig['mod_fcgid_maxrequests'] . "\n";
}
else
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$this->settings['system']['mod_fcgid_maxrequests'] . "\n";
}
$starter_file.= "export PHP_FCGI_MAX_REQUESTS\n";
// @FIXME don't use fcgid settings if not fcgid in use, but we don't have anything else atm
$phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']);
// Set Binary
$starter_file.= "exec " . $phpconfig['binary'] . " -c " . escapeshellarg($configdir) . "\n";
//remove +i attibute, so starter can be overwritten
if(file_exists($starter_filename))
{
removeImmutable($starter_filename);
}
$starter_file_handler = fopen($starter_filename, 'w');
fwrite($starter_file_handler, $starter_file);
fclose($starter_file_handler);
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));
// create starter-file | config-file
$php->getInterface()->createConfig($phpconfig);
// create php.ini
// @TODO make php-fpm support this
$php->getInterface()->createIniFile($phpconfig);
}
}
}
?>

View File

@@ -61,6 +61,12 @@ class lighttpd
public function reload()
{
if((int)$this->settings['phpfpm']['enabled'] == 1)
{
fwrite($this->debugHandler, ' lighttpd::reload: reloading php-fpm' . "\n");
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'reloading php-fpm');
safe_exec(escapeshellcmd($this->settings['phpfpm']['reload']));
}
fwrite($this->debugHandler, ' lighttpd::reload: reloading lighttpd' . "\n");
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'reloading lighttpd');
safe_exec(escapeshellcmd($this->settings['system']['apachereload_command']));
@@ -138,6 +144,38 @@ class lighttpd
$this->lighttpd_data[$vhost_filename].= ' }' . "\n";
*/
/**
* own php-fpm vhost
*/
if((int)$this->settings['phpfpm']['enabled'] == 1)
{
$domain = array(
'id' => 'none',
'domain' => $this->settings['system']['hostname'],
'adminid' => 1, /* first admin-user (superadmin) */
'mod_fcgid_starter' => -1,
'mod_fcgid_maxrequests' => -1,
'guid' => $this->settings['phpfpm']['vhost_httpuser'],
'openbasedir' => 0,
'safemode' => '0',
'email' => $this->settings['panel']['adminmail'],
'loginname' => 'froxlor.panel',
'documentroot' => $mypath
);
$php = new phpinterface($this->getDB(), $this->settings, $domain);
$this->lighttpd_data[$vhost_filename].= ' fastcgi.server = ( '."\n";
$this->lighttpd_data[$vhost_filename].= "\t".'".php" => ('."\n";
$this->lighttpd_data[$vhost_filename].= "\t\t".'"localhost" => ('."\n";
$this->lighttpd_data[$vhost_filename].= "\t\t".'"socket" => "'.$php->getInterface()->getSocketFile().'",'."\n";
$this->lighttpd_data[$vhost_filename].= "\t\t".'"check-local" => "enable",'."\n";
$this->lighttpd_data[$vhost_filename].= "\t\t".'"disable-time" => 1'."\n";
$this->lighttpd_data[$vhost_filename].= "\t".')'."\n";
$this->lighttpd_data[$vhost_filename].= "\t".')'."\n";
$this->lighttpd_data[$vhost_filename].= ' )'."\n";
}
if($row_ipsandports['specialsettings'] != '')
{
$this->lighttpd_data[$vhost_filename].= $row_ipsandports['specialsettings'] . "\n";

View File

@@ -28,241 +28,86 @@ if(@php_sapi_name() != 'cli'
class lighttpd_fcgid extends lighttpd
{
private $php_configs_cache = array();
private $admin_cache = array();
protected function composePhpOptions($domain)
{
$php_options_text = '';
if($domain['phpenabled'] == '1')
{
// This vHost has PHP enabled and we are using mod_fcgid
//create basic variables for config
$php = new phpinterface($this->getDB(), $this->settings, $domain);
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
$configdir = makeCorrectDir($this->settings['system']['mod_fcgid_configdir'] . '/' . $domain['loginname'] . '/' . $domain['domain'] . '/');
$starter_filename = makeCorrectFile($configdir . '/php-fcgi-starter');
$phpini_filename = makeCorrectFile($configdir . '/php.ini');
$tmpdir = makeCorrectDir($this->settings['system']['mod_fcgid_tmpdir'] . '/' . $domain['loginname'] . '/');
// create config dir if necessary
if(!is_dir($configdir))
// vhost data for php-fpm
if((int)$this->settings['phpfpm']['enabled'] == 1)
{
safe_exec('mkdir -p ' . escapeshellarg($configdir));
safe_exec('chown ' . $domain['guid'] . ':' . $domain['guid'] . ' ' . escapeshellarg($configdir));
}
// create tmp dir if necessary
if(!is_dir($tmpdir))
{
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
safe_exec('chown -R ' . $domain['guid'] . ':' . $domain['guid'] . ' ' . escapeshellarg($tmpdir));
safe_exec('chmod 0750 ' . escapeshellarg($tmpdir));
}
// Load php config
$phpconfig = $this->getPhpConfig((int)$domain['phpsettingid']);
$php_options_text = ' fastcgi.server = ( '."\n";
$file_extensions = explode(' ', $phpconfig['file_extensions']);
foreach($file_extensions as $f_extension)
{
$php_options_text.= "\t".'".'.$f_extension.'" => ('."\n";
$php_options_text = ' fastcgi.server = ( '."\n";
$php_options_text.= "\t".'".php" => ('."\n";
$php_options_text.= "\t\t".'"localhost" => ('."\n";
$php_options_text.= "\t\t".'"socket" => "/var/run/lighttpd/'.$domain['loginname'].'-'.$domain['domain'].'-php.socket",'."\n";
$php_options_text.= "\t\t".'"bin-path" => "'.$phpconfig['binary'].' -c '.$phpini_filename.'",'."\n";
$php_options_text.= "\t\t".'"bin-environment" => ('."\n";
if((int)$domain['mod_fcgid_starter'] != - 1)
$php_options_text.= "\t\t".'"socket" => "'.$php->getInterface()->getSocketFile().'",'."\n";
$php_options_text.= "\t\t".'"check-local" => "enable",'."\n";
$php_options_text.= "\t\t".'"disable-time" => 1'."\n";
$php_options_text.= "\t".')'."\n";
$php_options_text.= "\t".')'."\n";
$php_options_text.= ' )'."\n";
}
// vhost data for fcgid
elseif((int)$this->settings['system']['mod_fcgid'] == 1)
{
$php_options_text = ' fastcgi.server = ( '."\n";
$file_extensions = explode(' ', $phpconfig['file_extensions']);
foreach($file_extensions as $f_extension)
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_CHILDREN" => "' . (int)$domain['mod_fcgid_starter'] . '",'."\n";
}
else
{
if((int)$phpconfig['mod_fcgid_starter'] != - 1)
$php_options_text.= "\t".'".'.$f_extension.'" => ('."\n";
$php_options_text.= "\t\t".'"localhost" => ('."\n";
$php_options_text.= "\t\t".'"socket" => "/var/run/lighttpd/'.$domain['loginname'].'-'.$domain['domain'].'-php.socket",'."\n";
$php_options_text.= "\t\t".'"bin-path" => "'.$phpconfig['binary'].' -c '.$php->getInterface()->getIniFile().'",'."\n";
$php_options_text.= "\t\t".'"bin-environment" => ('."\n";
if((int)$domain['mod_fcgid_starter'] != - 1)
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_CHILDREN" => "' . (int)$phpconfig['mod_fcgid_starter'] . '",'."\n";
$php_options_text.= "\t\t\t".'"PHP_FCGI_CHILDREN" => "' . (int)$domain['mod_fcgid_starter'] . '",'."\n";
}
else
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_CHILDREN" => "' . (int)$this->settings['system']['mod_fcgid_starter'] . '",'."\n";
if((int)$phpconfig['mod_fcgid_starter'] != - 1)
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_CHILDREN" => "' . (int)$phpconfig['mod_fcgid_starter'] . '",'."\n";
}
else
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_CHILDREN" => "' . (int)$this->settings['system']['mod_fcgid_starter'] . '",'."\n";
}
}
}
if((int)$domain['mod_fcgid_maxrequests'] != - 1)
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_MAX_REQUESTS" => "' . (int)$domain['mod_fcgid_maxrequests'] . '"'."\n";
}
else
{
if((int)$phpconfig['mod_fcgid_maxrequests'] != - 1)
if((int)$domain['mod_fcgid_maxrequests'] != - 1)
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_MAX_REQUESTS" => "' . (int)$phpconfig['mod_fcgid_maxrequests'] . '"'."\n";
$php_options_text.= "\t\t\t".'"PHP_FCGI_MAX_REQUESTS" => "' . (int)$domain['mod_fcgid_maxrequests'] . '"'."\n";
}
else
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_MAX_REQUESTS" => "' . (int)$this->settings['system']['mod_fcgid_maxrequests'] . '"'."\n";
if((int)$phpconfig['mod_fcgid_maxrequests'] != - 1)
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_MAX_REQUESTS" => "' . (int)$phpconfig['mod_fcgid_maxrequests'] . '"'."\n";
}
else
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_MAX_REQUESTS" => "' . (int)$this->settings['system']['mod_fcgid_maxrequests'] . '"'."\n";
}
}
}
$php_options_text.= "\t\t".')'."\n";
$php_options_text.= "\t".')'."\n";
$php_options_text.= "\t".')'."\n";
} // foreach extension
$php_options_text.= ' )'."\n";
// create starter
$starter_file = "#!/bin/sh\n\n";
$starter_file.= "#\n";
$starter_file.= "# starter created/changed on " . date("Y.m.d H:i:s") . " for domain '" . $domain['domain'] . "' with id #" . $domain['id'] . " from php template '" . $phpconfig['description'] . "' with id #" . $phpconfig['id'] . "\n";
$starter_file.= "# Do not change anything in this file, it will be overwritten by the Froxlor Cronjob!\n";
$starter_file.= "#\n\n";
$starter_file.= "umask 022\n";
$starter_file.= "PHPRC=" . escapeshellarg($configdir) . "\n";
$starter_file.= "export PHPRC\n";
// set number of processes for one domain
if((int)$domain['mod_fcgid_starter'] != - 1)
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$domain['mod_fcgid_starter'] . "\n";
}
else
{
if((int)$phpconfig['mod_fcgid_starter'] != - 1)
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$phpconfig['mod_fcgid_starter'] . "\n";
}
else
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$this->settings['system']['mod_fcgid_starter'] . "\n";
}
$php_options_text.= "\t\t".')'."\n";
$php_options_text.= "\t".')'."\n";
$php_options_text.= "\t".')'."\n";
} // foreach extension
$php_options_text.= ' )'."\n";
}
$starter_file.= "export PHP_FCGI_CHILDREN\n";
// set number of maximum requests for one domain
if((int)$domain['mod_fcgid_maxrequests'] != - 1)
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$domain['mod_fcgid_maxrequests'] . "\n";
}
else
{
if((int)$phpconfig['mod_fcgid_maxrequests'] != - 1)
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$phpconfig['mod_fcgid_maxrequests'] . "\n";
}
else
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$this->settings['system']['mod_fcgid_maxrequests'] . "\n";
}
}
$starter_file.= "export PHP_FCGI_MAX_REQUESTS\n";
// Set Binary
$starter_file.= "exec " . $phpconfig['binary'] . " -c " . escapeshellarg($configdir) . "\n";
//remove +i attibute, so starter can be overwritten
if(file_exists($starter_filename))
{
removeImmutable($starter_filename);
}
$starter_file_handler = fopen($starter_filename, 'w');
fwrite($starter_file_handler, $starter_file);
fclose($starter_file_handler);
safe_exec('chmod 750 ' . escapeshellarg($starter_filename));
safe_exec('chown ' . $domain['guid'] . ':' . $domain['guid'] . ' ' . escapeshellarg($starter_filename));
setImmutable($starter_filename);
// define the php.ini
$openbasedir = '';
$openbasedirc = ';';
if($domain['openbasedir'] == '1')
{
$openbasedirc = '';
$_phpappendopenbasedir = '';
$_custom_openbasedir = explode(':', $this->settings['system']['mod_fcgid_peardir']);
foreach($_custom_openbasedir as $cobd)
{
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
}
$_custom_openbasedir = explode(':', $this->settings['system']['phpappendopenbasedir']);
foreach($_custom_openbasedir as $cobd)
{
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
}
if($domain['openbasedir_path'] == '0' && strstr($domain['documentroot'], ":") === false)
{
$openbasedir = appendOpenBasedirPath($domain['documentroot'], true);
}
else
{
$openbasedir = appendOpenBasedirPath($domain['customerroot'], true);
}
$openbasedir .= appendOpenBasedirPath($tmpdir);
$openbasedir .= $_phpappendopenbasedir;
$openbasedir = explode(':', $openbasedir);
$clean_openbasedir = array();
foreach($openbasedir as $number => $path)
{
if(trim($path) != '/')
{
$clean_openbasedir[] = makeCorrectDir($path);
}
}
$openbasedir = implode(':', $clean_openbasedir);
}
else
{
$openbasedir = 'none';
$openbasedirc = ';';
}
$admin = $this->getAdminData($domain['adminid']);
$php_ini_variables = array(
'SAFE_MODE' => ($domain['safemode'] == '0' ? 'Off' : 'On'),
'PEAR_DIR' => $this->settings['system']['mod_fcgid_peardir'],
'OPEN_BASEDIR' => $openbasedir,
'OPEN_BASEDIR_C' => $openbasedirc,
'OPEN_BASEDIR_GLOBAL' => $this->settings['system']['phpappendopenbasedir'],
'TMP_DIR' => $tmpdir,
'CUSTOMER_EMAIL' => $domain['email'],
'ADMIN_EMAIL' => $admin['email'],
'DOMAIN' => $domain['domain'],
'CUSTOMER' => $domain['loginname'],
'ADMIN' => $admin['loginname']
);
//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 domain '" . $domain['domain'] . "' with id #" . $domain['id'] . " 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));
// create starter-file | config-file
$php->getInterface()->createConfig($phpconfig);
// create php.ini
// @TODO make php-fpm support this
$php->getInterface()->createIniFile($phpconfig);
}
else
{
@@ -272,36 +117,46 @@ class lighttpd_fcgid extends lighttpd
return $php_options_text;
}
private function getPhpConfig($php_config_id)
public function createOwnVhostStarter()
{
$php_config_id = intval($php_config_id);
if ($this->settings['phpfpm']['enabled'] == '1'
&& $this->settings['phpfpm']['enabled_ownvhost'] == '1'
) {
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__)))); // /var/www/froxlor, needed for chown
// If domain has no config, we will use the default one.
$user = $this->settings['phpfpm']['vhost_httpuser'];
$group = $this->settings['phpfpm']['vhost_httpgroup'];
if($php_config_id == 0)
{
$php_config_id = 1;
$domain = array(
'id' => 'none',
'domain' => $this->settings['system']['hostname'],
'adminid' => 1, /* first admin-user (superadmin) */
'mod_fcgid_starter' => -1,
'mod_fcgid_maxrequests' => -1,
'guid' => $user,
'openbasedir' => 0,
'safemode' => '0',
'email' => $this->settings['panel']['adminmail'],
'loginname' => 'froxlor.panel',
'documentroot' => $mypath
);
// all the files and folders have to belong to the local user
// now because we also use fcgid for our own vhost
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
// get php.ini for our own vhost
$php = new phpinterface($this->getDB(), $this->settings, $domain);
// @FIXME don't use fcgid settings, but we don't have anything else atm
$phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']);
// create starter-file | config-file
$php->getInterface()->createConfig($phpconfig);
// create php.ini
// @TODO make php-fpm support this
$php->getInterface()->createIniFile($phpconfig);
}
if(!isset($this->php_configs_cache[$php_config_id]))
{
$this->php_configs_cache[$php_config_id] = $this->getDB()->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$php_config_id);
}
return $this->php_configs_cache[$php_config_id];
}
private function getAdminData($adminid)
{
$adminid = intval($adminid);
if(!isset($this->admin_cache[$adminid]))
{
$this->admin_cache[$adminid] = $this->getDB()->query_first("SELECT `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = " . (int)$adminid);
}
return $this->admin_cache[$adminid];
}
}
?>

View File

@@ -64,12 +64,19 @@ class nginx
/**
* nginx does not auto-spawn fcgi-processes
*/
if ($this->settings['system']['phpreload_command'] != '')
{
fwrite($this->debugHandler, ' nginx::reload: restarting php processes' . "\n");
if ($this->settings['system']['phpreload_command'] != ''
&& (int)$this->settings['phpfpm']['enabled'] == 0
) {
fwrite($this->debugHandler, ' nginx::reload: restarting php processes' . "\n");
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'restarting php processes');
safe_exec($this->settings['system']['phpreload_command']);
}
elseif((int)$this->settings['phpfpm']['enabled'] == 1)
{
fwrite($this->debugHandler, ' nginx::reload: reloading php-fpm' . "\n");
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'reloading php-fpm');
safe_exec(escapeshellcmd($this->settings['phpfpm']['reload']));
}
}
public function createVirtualHosts()
@@ -103,7 +110,7 @@ class nginx
if(!isset($this->nginx_data[$vhosts_filename]))
{
$this->vnginx_data[$vhosts_filename] = '';
$this->nginx_data[$vhosts_filename] = '';
}
if($this->settings['defaultwebsrverrhandler']['err401'] != '')
@@ -221,8 +228,30 @@ class nginx
$this->nginx_data[$vhost_filename].= "\t".'location ~ \.php$ {'."\n";
$this->nginx_data[$vhost_filename].= "\t\t".'fastcgi_index index.php;'."\n";
$this->nginx_data[$vhost_filename].= "\t\t".'include /etc/nginx/fastcgi_params;'."\n";
$this->nginx_data[$vhost_filename].= "\t\t".'fastcgi_param SCRIPT_FILENAME $document_root' . '$fastcgi_script_name;'."\n";
$this->nginx_data[$vhost_filename].= "\t\t".'fastcgi_pass ' . $this->settings['system']['nginx_php_backend'] . ';' . "\n";
$this->nginx_data[$vhost_filename].= "\t\t".'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;'."\n";
if((int)$this->settings['phpfpm']['enabled'] == 1)
{
$domain = array(
'id' => 'none',
'domain' => $this->settings['system']['hostname'],
'adminid' => 1, /* first admin-user (superadmin) */
'mod_fcgid_starter' => -1,
'mod_fcgid_maxrequests' => -1,
'guid' => $this->settings['phpfpm']['vhost_httpuser'],
'openbasedir' => 0,
'safemode' => '0',
'email' => $this->settings['panel']['adminmail'],
'loginname' => 'froxlor.panel',
'documentroot' => $mypath
);
$php = new phpinterface($this->getDB(), $this->settings, $domain);
$this->nginx_data[$vhost_filename].= "\t\t".'fastcgi_pass unix:' . $php->getInterface()->getSocketFile() . ';' . "\n";
}
else
{
$this->nginx_data[$vhost_filename].= "\t\t".'fastcgi_pass ' . $this->settings['system']['nginx_php_backend'] . ';' . "\n";
}
$this->nginx_data[$vhost_filename].= "\t".'}'."\n";
$this->nginx_data[$vhost_filename].= '}' . "\n\n";
@@ -495,7 +524,7 @@ class nginx
$query = "SELECT * FROM " . TABLE_PANEL_HTPASSWDS . " WHERE `customerid`='" . $domain['customerid'] . "'";
$result = $this->db->query($query);
$result = array();
$returnval = array();
$x = 0;
while($row_htpasswds = $this->db->fetch_array($result))
{
@@ -515,13 +544,13 @@ class nginx
$path = makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
$result[$x]['path'] = $path;
$result[$x]['root'] = makeCorrectDir($domain['documentroot']);
$result[$x]['usrf'] = $htpasswd_filename;
$returnval[$x]['path'] = $path;
$returnval[$x]['root'] = makeCorrectDir($domain['documentroot']);
$returnval[$x]['usrf'] = $htpasswd_filename;
$x++;
}
}
return $result;
return $returnval;
}
protected function composePhpOptions($domain)
@@ -532,7 +561,7 @@ class nginx
$phpopts = "\t".'location ~ \.php$ {'."\n";
$phpopts.= "\t\t".'fastcgi_index index.php;'."\n";
$phpopts.= "\t\t".'include /etc/nginx/fastcgi_params;'."\n";
$phpopts.= "\t\t".'fastcgi_param SCRIPT_FILENAME $document_root' . '$fastcgi_script_name;'."\n";
$phpopts.= "\t\t".'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;'."\n";
$phpopts.= "\t\t".'fastcgi_pass ' . $this->settings['system']['nginx_php_backend'] . ';' . "\n";
$phpopts.= "\t".'}'."\n";
}

View File

@@ -0,0 +1,104 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Cron
* @version $Id$
*/
/*
* This script creates the php.ini's used by mod_suPHP+php-cgi
*/
if(@php_sapi_name() != 'cli'
&& @php_sapi_name() != 'cgi'
&& @php_sapi_name() != 'cgi-fcgi')
{
die('This script only works in the shell.');
}
class nginx_phpfpm extends nginx
{
protected function composePhpOptions($domain)
{
$php_options_text = '';
if($domain['phpenabled'] == '1')
{
$php = new phpinterface($this->getDB(), $this->settings, $domain);
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
$php_options_text = "\t".'location ~ \.php$ {'."\n";
$php_options_text.= "\t\t".'fastcgi_index index.php;'."\n";
$php_options_text.= "\t\t".'include /etc/nginx/fastcgi_params;'."\n";
$php_options_text.= "\t\t".'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;'."\n";
$php_options_text.= "\t\t".'fastcgi_pass unix:' . $php->getInterface()->getSocketFile() . ';' . "\n";
$php_options_text.= "\t".'}'."\n";
// create starter-file | config-file
$php->getInterface()->createConfig($phpconfig);
// create php.ini
// @TODO make php-fpm support this
$php->getInterface()->createIniFile($phpconfig);
}
else
{
$php_options_text.= ' # PHP is disabled for this vHost' . "\n";
}
return $php_options_text;
}
public function createOwnVhostStarter()
{
if ($this->settings['phpfpm']['enabled'] == '1'
&& $this->settings['phpfpm']['enabled_ownvhost'] == '1'
) {
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__)))); // /var/www/froxlor, needed for chown
$user = $this->settings['phpfpm']['vhost_httpuser'];
$group = $this->settings['phpfpm']['vhost_httpgroup'];
$domain = array(
'id' => 'none',
'domain' => $this->settings['system']['hostname'],
'adminid' => 1, /* first admin-user (superadmin) */
'mod_fcgid_starter' => -1,
'mod_fcgid_maxrequests' => -1,
'guid' => $user,
'openbasedir' => 0,
'safemode' => '0',
'email' => $this->settings['panel']['adminmail'],
'loginname' => 'froxlor.panel',
'documentroot' => $mypath
);
// all the files and folders have to belong to the local user
// now because we also use fcgid for our own vhost
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
// get php.ini for our own vhost
$php = new phpinterface($this->getDB(), $this->settings, $domain);
// @FIXME don't use fcgid settings, but we don't have anything else atm
$phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']);
// create starter-file | config-file
$php->getInterface()->createConfig($phpconfig);
// create php.ini
// @TODO make php-fpm support this
$php->getInterface()->createIniFile($phpconfig);
}
}
}

View File

@@ -26,6 +26,7 @@ require_once(makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.15.apache
require_once(makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.20.lighttpd.php'));
require_once(makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.25.lighttpd_fcgid.php'));
require_once(makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.30.nginx.php'));
require_once(makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.35.nginx_phpfpm.php'));
/**
* LOOK INTO TASKS TABLE TO SEE IF THERE ARE ANY UNDONE JOBS
@@ -67,7 +68,7 @@ while($row = $db->fetch_array($result_tasks))
{
$awstatsclean['dir'] = dir($awstatsclean['path']);
while($awstatsclean['entry'] = $awstatsclean['dir']->read()) {
$awstatsclean['fullentry'] = $awstatsclean['path'].'/'.$awstatsclean['entry'];
$awstatsclean['fullentry'] = makeCorrectFile($awstatsclean['path'].'/'.$awstatsclean['entry']);
/**
* dont do anything if the file does not exist
*/
@@ -120,11 +121,25 @@ while($row = $db->fetch_array($result_tasks))
}
}
// clear php-fpm-configurations prior to re-creation to keep it clean
if ($settings['phpfpm']['enabled'] == '1')
{
$configdir = makeCorrectDir($settings['phpfpm']['configdir']);
if (is_dir($configdir))
{
// now get rid of old stuff
//(but append /* so we don't delete the directory)
$configdir.='/*';
safe_exec('rm -rf '. makeCorrectFile($configdir));
}
}
if(!isset($webserver))
{
if($settings['system']['webserver'] == "apache2")
{
if($settings['system']['mod_fcgid'] == 1)
if($settings['system']['mod_fcgid'] == 1 || $settings['phpfpm']['enabled'] == 1)
{
$webserver = new apache_fcgid($db, $cronlog, $debugHandler, $idna_convert, $settings);
}
@@ -135,7 +150,7 @@ while($row = $db->fetch_array($result_tasks))
}
elseif($settings['system']['webserver'] == "lighttpd")
{
if($settings['system']['mod_fcgid'] == 1)
if($settings['system']['mod_fcgid'] == 1 || $settings['phpfpm']['enabled'] == 1)
{
$webserver = new lighttpd_fcgid($db, $cronlog, $debugHandler, $idna_convert, $settings);
}
@@ -146,7 +161,14 @@ while($row = $db->fetch_array($result_tasks))
}
elseif($settings['system']['webserver'] == "nginx")
{
$webserver = new nginx($db, $cronlog, $debugHandler, $idna_convert, $settings);
if($settings['phpfpm']['enabled'] == 1)
{
$webserver = new nginx_phpfpm($db, $cronlog, $debugHandler, $idna_convert, $settings);
}
else
{
$webserver = new nginx($db, $cronlog, $debugHandler, $idna_convert, $settings);
}
}
}

View File

@@ -0,0 +1,11 @@
<IfModule mod_fastcgi.c>
FastCgiWrapper /usr/lib/apache2/suexec
FastCgiIpcDir /var/run/apache2/
<Location "/fastcgiphp">
Order Deny,Allow
Deny from All
# Prevent accessing this path directly
Allow from env=REDIRECT_STATUS
</Location>
</IfModule>

View File

@@ -1,5 +1,5 @@
driver = mysql
connect = host=<SQL_HOST> dbname=<SQL_DB> user=<SQL_UNPRIVILEGED_USER> password=<SQL_UNPRIVILEGED_PASSWORD>
default_pass_scheme = CRYPT
password_query = SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('maildir:', homedir, maildir) AS userdb_mail, CONCAT('maildir:storage=', (quota*1024)) as userdb_quota FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3'))
password_query = SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('maildir:', homedir, maildir) AS userdb_mail, CONCAT('maildir:storage=', (quota*1024)) as userdb_quota FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3') OR '%Ls' = 'smtp')
user_query = SELECT CONCAT(homedir, maildir) AS home, CONCAT('maildir:', homedir, maildir) AS mail, uid, gid, CONCAT('maildir:storage=', (quota*1024)) as quota FROM mail_users WHERE (username = '%u' OR email = '%u')

View File

@@ -1,5 +1,5 @@
driver = mysql
connect = host=<SQL_HOST> dbname=<SQL_DB> user=<SQL_UNPRIVILEGED_USER> password=<SQL_UNPRIVILEGED_PASSWORD>
default_pass_scheme = CRYPT
password_query = SELECT username AS user, password_enc AS password FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3'))
password_query = SELECT username AS user, password_enc AS password FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3') OR '%Ls' = 'smtp')
user_query = SELECT CONCAT(homedir,maildir) AS home, concat('maildir:',homedir,maildir) AS mail, uid, gid FROM mail_users where (username = '%u' OR email = '%u')

View File

@@ -0,0 +1,11 @@
<IfModule mod_fastcgi.c>
FastCgiWrapper /usr/sbin/suexec
FastCgiIpcDir /var/run/apache2/
<Location "/fastcgiphp">
Order Deny,Allow
Deny from All
# Prevent accessing this path directly
Allow from env=REDIRECT_STATUS
</Location>
</IfModule>

View File

@@ -7,4 +7,4 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
#
# Please check that all following paths are correct
#
*/5 * * * * root /usr/lib/php5/bin/php -q <BASE_PATH>scripts/froxlor_master_cronjob.php
*/5 * * * * root /usr/bin/php -q <BASE_PATH>scripts/froxlor_master_cronjob.php

View File

@@ -1,5 +1,5 @@
driver = mysql
connect = host=<SQL_HOST> dbname=<SQL_DB> user=<SQL_UNPRIVILEGED_USER> password=<SQL_UNPRIVILEGED_PASSWORD>
default_pass_scheme = CRYPT
password_query = "SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('*:storage=', quota,'M') AS userdb_quota_rule FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3'))"
password_query = "SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('*:storage=', quota,'M') AS userdb_quota_rule FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3') OR '%Ls' = 'smtp')"
user_query = "SELECT CONCAT(homedir, maildir) AS home, uid, gid, CONCAT('*:storage=', quota,'M') AS quota_rule FROM mail_users WHERE (username = '%u' OR email = '%u')"

View File

@@ -0,0 +1,11 @@
<IfModule mod_fastcgi.c>
FastCgiWrapper /usr/lib/apache2/suexec
FastCgiIpcDir /var/run/apache2/
<Location "/fastcgiphp">
Order Deny,Allow
Deny from All
# Prevent accessing this path directly
Allow from env=REDIRECT_STATUS
</Location>
</IfModule>

View File

@@ -1,5 +1,5 @@
driver = mysql
connect = host=<SQL_HOST> dbname=<SQL_DB> user=<SQL_UNPRIVILEGED_USER> password=<SQL_UNPRIVILEGED_PASSWORD>
default_pass_scheme = CRYPT
password_query = SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('maildir:', homedir, maildir) AS userdb_mail, CONCAT('maildir:storage=', (quota*1024)) as userdb_quota FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3'))
password_query = SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('maildir:', homedir, maildir) AS userdb_mail, CONCAT('maildir:storage=', (quota*1024)) as userdb_quota FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3') OR '%Ls' = 'smtp')
user_query = SELECT CONCAT(homedir, maildir) AS home, CONCAT('maildir:', homedir, maildir) AS mail, uid, gid, CONCAT('maildir:storage=', (quota*1024)) as quota FROM mail_users WHERE (username = '%u' OR email = '%u')

View File

@@ -0,0 +1,11 @@
<IfModule mod_fastcgi.c>
FastCgiWrapper /usr/lib/apache2/suexec
FastCgiIpcDir /var/run/apache2/
<Location "/fastcgiphp">
Order Deny,Allow
Deny from All
# Prevent accessing this path directly
Allow from env=REDIRECT_STATUS
</Location>
</IfModule>

View File

@@ -1,6 +1,6 @@
driver = mysql
connect = host=<SQL_HOST> dbname=<SQL_DB> user=<SQL_UNPRIVILEGED_USER> password=<SQL_UNPRIVILEGED_PASSWORD>
default_pass_scheme = CRYPT
password_query = SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('maildir:', homedir, maildir) AS userdb_mail, CONCAT('maildir:storage=', (quota*1024)) as userdb_quota FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3'))
password_query = SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('maildir:', homedir, maildir) AS userdb_mail, CONCAT('maildir:storage=', (quota*1024)) as userdb_quota FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3') OR '%Ls' = 'smtp')
user_query = SELECT CONCAT(homedir, maildir) AS home, CONCAT('maildir:', homedir, maildir) AS mail, uid, gid, CONCAT('*:storage=', (quota*1024)) as quota_rule FROM mail_users WHERE (username = '%u' OR email = '%u')