Commit 001bac91 authored by Marius Burkard's avatar Marius Burkard

Merge branch 'remove-php-modes' into 'master'

Remove php modes

Closes #4893

See merge request !840
parents ea9f8ef6 7349f551
......@@ -72,9 +72,6 @@ $conf['mysql']['master_admin_password'] = '';
$conf['mysql']['master_ispconfig_user'] = '';
$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
//* SuPHP
$conf['suphp']['config_file'] = '/etc/suphp.conf';
//* Apache
$conf['apache']['installed'] = false; // will be detected automatically during installation
$conf['apache']['user'] = 'apache';
......
......@@ -696,11 +696,6 @@ class installer_dist extends installer_base {
global $conf;
if($conf['apache']['installed'] == false) return;
if(is_file('/etc/suphp.conf')) {
//replaceLine('/etc/suphp.conf','php=php:/usr/bin','x-httpd-suphp=php:/usr/bin/php-cgi',0);
replaceLine('/etc/suphp.conf', 'docroot=', 'docroot=/var/www', 0);
replaceLine('/etc/suphp.conf', 'umask=0077', 'umask=0022', 0);
}
//* Create the logging directory for the vhost logfiles
exec('mkdir -p /var/log/ispconfig/httpd');
......
......@@ -555,19 +555,6 @@ class installer extends installer_base
mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
}
if (is_file($conf['suphp']['config_file']))
{
$content = rf($conf['suphp']['config_file']);
if (!preg_match('|^x-httpd-suphp=php:/usr/bin/php-cgi$|m', $content))
{
$content = preg_replace('/;Handler for php-scripts/', ";Handler for php-scripts\nx-httpd-suphp=php:/usr/bin/php-cgi", $content);
$content = preg_replace('/;?umask=\d+/', 'umask=0022', $content);
}
$this->write_config_file($conf['suphp']['config_file'], $content);
}
//* Enable ISPConfig default vhost settings
$default_vhost_path = $conf['apache']['vhost_conf_dir'].'/'.$conf['apache']['vhost_default'];
if (is_file($default_vhost_path))
......
......@@ -663,13 +663,6 @@ class installer_dist extends installer_base {
//* enable apache logio module
exec('a2enmod logio');
//if(is_file('/etc/suphp.conf')) {
replaceLine('/etc/suphp.conf', 'php=php', 'x-httpd-suphp="php:/srv/www/cgi-bin/php5"', 0, 0);
replaceLine('/etc/suphp.conf', 'php="php', 'x-httpd-suphp="php:/srv/www/cgi-bin/php5"', 0, 0);
replaceLine('/etc/suphp.conf', 'docroot=', 'docroot=/srv/www', 0, 0);
replaceLine('/etc/suphp.conf', 'umask=0077', 'umask=0022', 0);
//}
if(!file_exists('/srv/www/cgi-bin/php5') && file_exists('/srv/www/cgi-bin/php')) {
symlink('/srv/www/cgi-bin/php', '/srv/www/cgi-bin/php5');
}
......@@ -1249,9 +1242,6 @@ class installer_dist extends installer_base {
}
}
// Fix a setting in vhost master file for suse
replaceLine('/usr/local/ispconfig/server/conf/vhost.conf.master', "suPHP_UserGroup", " suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>", 0);
}
if($conf['nginx']['installed'] == true && $this->install_ispconfig_interface == true){
......
......@@ -1938,12 +1938,6 @@ class installer_base {
//* Create the logging directory for the vhost logfiles
if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
if(is_file('/etc/suphp/suphp.conf')) {
replaceLine('/etc/suphp/suphp.conf', 'php="php:/usr/bin', 'x-httpd-suphp="php:/usr/bin/php-cgi"', 0);
//replaceLine('/etc/suphp/suphp.conf','docroot=','docroot=/var/clients',0);
replaceLine('/etc/suphp/suphp.conf', 'umask=00', 'umask=0022', 0);
}
if(is_file('/etc/apache2/sites-enabled/000-default')) {
replaceLine('/etc/apache2/sites-available/000-default', 'NameVirtualHost *', 'NameVirtualHost *:80', 1, 0);
replaceLine('/etc/apache2/sites-available/000-default', '<VirtualHost *>', '<VirtualHost *:80>', 1, 0);
......
......@@ -269,7 +269,7 @@ class remoting_server extends remoting {
$web_config[$server_id] = $app->getconf->get_server_config($server_id, 'web');
$server_type = !empty($web_config[$server_id]['server_type']) ? $web_config[$server_id]['server_type'] : 'apache';
if ($php === 'php-fpm' || ($php === 'hhvm' && $server_type === 'nginx')) {
if ($php === 'php-fpm') {
$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0)", $server_id);
foreach ($php_records as $php_record) {
$php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
......
......@@ -1242,7 +1242,7 @@ $form["tabs"]['web'] = array(
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => 'fast-cgi',
'value' => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM', 'hhvm' => 'HHVM'),
'value' => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'mod' => 'Mod-PHP', 'php-fpm' => 'PHP-FPM'),
'searchable' => 2
),
'nginx_cgi_socket' => array(
......
......@@ -1100,7 +1100,7 @@ $form["tabs"]['limits'] = array (
'default' => '',
'separator' => ',',
'valuelimit' => 'client:web_php_options',
'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM', 'hhvm' => 'HHVM')
'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'mod' => 'Mod-PHP', 'php-fpm' => 'PHP-FPM')
),
'limit_cgi' => array (
'datatype' => 'VARCHAR',
......
......@@ -508,7 +508,7 @@ $form["tabs"]['limits'] = array (
'default' => '',
'separator' => ',',
'valuelimit' => 'client:web_php_options',
'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM', 'hhvm' => 'HHVM')
'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'mod' => 'Mod-PHP', 'php-fpm' => 'PHP-FPM')
),
'limit_cgi' => array (
'datatype' => 'VARCHAR',
......
......@@ -1097,7 +1097,7 @@ $form["tabs"]['limits'] = array (
),
'default' => '',
'separator' => ',',
'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM', 'hhvm' => 'HHVM')
'value' => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'mod' => 'Mod-PHP', 'php-fpm' => 'PHP-FPM')
),
'limit_cgi' => array (
'datatype' => 'VARCHAR',
......
......@@ -92,7 +92,7 @@ if($type == 'getphpfastcgi'){
$sql_where .= ")";
}
if($php_type == 'php-fpm' || ($php_type == 'hhvm' && $server_type == 'nginx')){
if($php_type == 'php-fpm'){
$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND active = 'y' ORDER BY name".$sql_where, $server_id);
} elseif($php_type == 'fast-cgi'){
$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ? AND active = 'y' ORDER BY name".$sql_where, $server_id);
......@@ -102,7 +102,7 @@ if($type == 'getphpfastcgi'){
$php_select = "";
if(is_array($php_records) && !empty($php_records)) {
foreach( $php_records as $php_record) {
if($php_type == 'php-fpm' || ($php_type == 'hhvm' && $server_type == 'nginx')){
if($php_type == 'php-fpm'){
$php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
} else {
$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
......
......@@ -251,7 +251,7 @@ $form["tabs"]['domain'] = array (
'formtype' => 'SELECT',
'default' => 'fast-cgi',
'valuelimit' => 'client:web_php_options',
'value' => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM', 'hhvm' => 'HHVM'),
'value' => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'mod' => 'Mod-PHP', 'php-fpm' => 'PHP-FPM'),
'searchable' => 2
),
'fastcgi_php_version' => array (
......
......@@ -293,31 +293,21 @@
reloadFastcgiPHPVersions();
});
if(jQuery('#php').val() == 'fast-cgi' || jQuery('#php').val() == 'php-fpm' || (jQuery('#php').val() == 'hhvm' && serverType == 'nginx')){
if(jQuery('#php').val() == 'fast-cgi' || jQuery('#php').val() == 'php-fpm'){
jQuery('.fastcgi_php_version:hidden').show();
if(jQuery('#php').val() == 'hhvm'){
jQuery('#fastcgi_php_version_txt').hide();
jQuery('#fastcgi_php_fallback_version_txt').show();
} else {
jQuery('#fastcgi_php_version_txt').show();
jQuery('#fastcgi_php_fallback_version_txt').hide();
}
} else {
jQuery('#fastcgi_php_version_txt').show();
jQuery('#fastcgi_php_fallback_version_txt').hide();
} else {
jQuery('.fastcgi_php_version:visible').hide();
}
//ISPConfig.resetFormChanged();
jQuery('#php').change(function(){
reloadFastcgiPHPVersions();
if(jQuery(this).val() == 'fast-cgi' || jQuery(this).val() == 'php-fpm' || (jQuery(this).val() == 'hhvm' && serverType == 'nginx')){
if(jQuery(this).val() == 'fast-cgi' || jQuery(this).val() == 'php-fpm'){
jQuery('.fastcgi_php_version:hidden').show();
if(jQuery(this).val() == 'hhvm'){
jQuery('#fastcgi_php_version_txt').hide();
jQuery('#fastcgi_php_fallback_version_txt').show();
} else {
jQuery('#fastcgi_php_version_txt').show();
jQuery('#fastcgi_php_fallback_version_txt').hide();
}
jQuery('#fastcgi_php_version_txt').show();
jQuery('#fastcgi_php_fallback_version_txt').hide();
} else {
jQuery('.fastcgi_php_version:visible').hide();
}
......@@ -373,21 +363,17 @@
}
});
*/
if(selected != "no" && selected != "php-fpm" && selected != "hhvm") {
if(selected != "no" && selected != "php-fpm") {
jQuery('#php option[value="php-fpm"]').attr('selected', 'selected').val('php-fpm');
}
jQuery('#php option[value="fast-cgi"]').hide();
jQuery('#php option[value="cgi"]').hide();
jQuery('#php option[value="mod"]').hide();
jQuery('#php option[value="suphp"]').hide();
} else {
serverType = 'apache';
jQuery('.nginx').hide();
jQuery('.apache').show();
jQuery('#php option[value="fast-cgi"]').show();
jQuery('#php option[value="cgi"]').show();
jQuery('#php option[value="mod"]').show();
jQuery('#php option[value="suphp"]').show();
}
if(noFormChange) {
ISPConfig.resetFormChanged();
......
......@@ -243,14 +243,14 @@ class page_action extends tform_actions {
if($server_type == 'nginx' && $this->dataRecord['php'] == 'fast-cgi') $this->dataRecord['php'] = 'php-fpm';
if($this->_vhostdomain_type == 'domain') {
if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){
if($this->dataRecord['php'] == 'php-fpm'){
$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?) AND active = 'y' ORDER BY name", ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $_SESSION['s']['user']['client_id']);
}
if($this->dataRecord['php'] == 'fast-cgi'){
$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?) AND active = 'y' ORDER BY name", ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $_SESSION['s']['user']['client_id']);
}
} else {
if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){
if($this->dataRecord['php'] == 'php-fpm'){
$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?) AND active = 'y' ORDER BY name", $parent_domain['server_id'], $_SESSION['s']['user']['client_id']);
}
if($this->dataRecord['php'] == 'fast-cgi'){
......@@ -260,7 +260,7 @@ class page_action extends tform_actions {
$php_select = "<option value=''>".$app->functions->htmlentities($web_config['php_default_name'])."</option>";
if(is_array($php_records) && !empty($php_records)) {
foreach( $php_records as $php_record) {
if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){
if($this->dataRecord['php'] == 'php-fpm'){
$php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
} else {
$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
......@@ -390,14 +390,14 @@ class page_action extends tform_actions {
$selected_client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ?", $selected_client_group_id);
$sql_where = " AND (client_id = 0 OR client_id = ?) AND active = 'y'";
if($this->_vhostdomain_type == 'domain') {
if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){
if($this->dataRecord['php'] == 'php-fpm'){
$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?".$sql_where." ORDER BY name", ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $selected_client['client_id']);
}
if($this->dataRecord['php'] == 'fast-cgi') {
$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ?".$sql_where." ORDER BY name", ($this->id > 0 ? $this->dataRecord['server_id'] : $client['default_webserver']), $selected_client['client_id']);
}
} else {
if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){
if($this->dataRecord['php'] == 'php-fpm'){
$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND (client_id = 0 OR client_id=?) AND active = 'y' ORDER BY name", $parent_domain['server_id'], $_SESSION['s']['user']['client_id']);
}
if($this->dataRecord['php'] == 'fast-cgi') {
......@@ -407,7 +407,7 @@ class page_action extends tform_actions {
$php_select = "<option value=''>".$app->functions->htmlentities($web_config['php_default_name'])."</option>";
if(is_array($php_records) && !empty($php_records)) {
foreach( $php_records as $php_record) {
if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){
if($this->dataRecord['php'] == 'php-fpm'){
$php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
} else {
$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
......@@ -610,14 +610,14 @@ class page_action extends tform_actions {
$selected_client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ?", $selected_client_group_id);
$sql_where = " AND (client_id = 0 OR client_id = ?) AND active = 'y'";
if($this->_vhostdomain_type == 'domain') {
if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){
if($this->dataRecord['php'] == 'php-fpm'){
$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ?".$sql_where." ORDER BY name", $server_id, $selected_client['client_id']);
}
if($this->dataRecord['php'] == 'fast-cgi') {
$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = ?".$sql_where." ORDER BY name", $server_id, $selected_client['client_id']);
}
} else {
if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){
if($this->dataRecord['php'] == 'php-fpm'){
$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = ? AND active = 'y' ORDER BY name", $parent_domain['server_id']);
}
if($this->dataRecord['php'] == 'fast-cgi') {
......@@ -627,7 +627,7 @@ class page_action extends tform_actions {
$php_select = "<option value=''>".$app->functions->htmlentities($web_config['php_default_name'])."</option>";
if(is_array($php_records) && !empty($php_records)) {
foreach( $php_records as $php_record) {
if($this->dataRecord['php'] == 'php-fpm' || ($this->dataRecord['php'] == 'hhvm' && $server_type == 'nginx')){
if($this->dataRecord['php'] == 'php-fpm'){
$php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
} else {
$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
......
......@@ -111,7 +111,7 @@ function start_import() {
//* add client
$sql = "INSERT INTO `client` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `company_name`, `company_id`, `contact_name`, `customer_no`, `vat_id`, `street`, `zip`, `city`, `state`, `country`, `telephone`, `mobile`, `fax`, `email`, `internet`, `icq`, `notes`, `bank_account_owner`, `bank_account_number`, `bank_code`, `bank_name`, `bank_account_iban`, `bank_account_swift`, `default_mailserver`, `limit_maildomain`, `limit_mailbox`, `limit_mailalias`, `limit_mailaliasdomain`, `limit_mailforward`, `limit_mailcatchall`, `limit_mailrouting`, `limit_mailfilter`, `limit_fetchmail`, `limit_mailquota`, `limit_spamfilter_wblist`, `limit_spamfilter_user`, `limit_spamfilter_policy`, `default_webserver`, `limit_web_ip`, `limit_web_domain`, `limit_web_quota`, `web_php_options`, `limit_cgi`, `limit_ssi`, `limit_perl`, `limit_ruby`, `limit_python`, `force_suexec`, `limit_hterror`, `limit_wildcard`, `limit_ssl`, `limit_web_subdomain`, `limit_web_aliasdomain`, `limit_ftp_user`, `limit_shell_user`, `ssh_chroot`, `limit_webdav_user`, `limit_aps`, `default_dnsserver`, `limit_dns_zone`, `limit_dns_slave_zone`, `limit_dns_record`, `default_dbserver`, `limit_database`, `limit_cron`, `limit_cron_type`, `limit_cron_frequency`, `limit_traffic_quota`, `limit_client`, `limit_mailmailinglist`, `limit_openvz_vm`, `limit_openvz_vm_template_id`, `parent_client_id`, `username`, `password`, `language`, `usertheme`, `template_master`, `template_additional`, `created_at`, `id_rsa`, `ssh_rsa`)
VALUES(1, 1, 'riud', 'riud', '', '', '', ?, '', '', '', '', '', '', ?, '', '', '', '', 'http://', '', '', '', '', '', '', '', '', 1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, 0, 0, 0, 1, NULL, -1, -1, 'no,fast-cgi,cgi,mod,suphp', 'n', 'n', 'n', 'n', 'n', 'y', 'n', 'n', 'n', -1, -1, -1, 0, 'no,jailkit', 0, 0, 1, -1, -1, -1, 1, -1, 0, 'url', 5, -1, 0, -1, 0, 0, 0, ?, ?, ?, 'default', 0, '', NOW(), '', '')";
VALUES(1, 1, 'riud', 'riud', '', '', '', ?, '', '', '', '', '', '', ?, '', '', '', '', 'http://', '', '', '', '', '', '', '', '', 1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, 0, 0, 0, 1, NULL, -1, -1, 'no,fast-cgi,mod', 'n', 'n', 'n', 'n', 'n', 'y', 'n', 'n', 'n', -1, -1, -1, 0, 'no,jailkit', 0, 0, 1, -1, -1, -1, 1, -1, 0, 'url', 5, -1, 0, -1, 0, 0, 0, ?, ?, ?, 'default', 0, '', NOW(), '', '')";
$app->db->query($sql, $pw_domain,$country, $pw_domain, $pw_crypt_password, $conf['language']);
$client_id = $app->db->insertID();
......
......@@ -51,7 +51,7 @@ try {
'limit_web_ip' => '',
'limit_web_domain' => -1,
'limit_web_quota' => -1,
'web_php_options' => 'no,fast-cgi,cgi,mod,suphp',
'web_php_options' => 'no,fast-cgi,mod',
'limit_web_subdomain' => -1,
'limit_web_aliasdomain' => -1,
'limit_ftp_user' => -1,
......
check process hhvm_{SYSTEM_USER} with pidfile /var/run/hhvm/hhvm_{SYSTEM_USER}.pid
start program = "/etc/init.d/hhvm_{SYSTEM_USER} restart"
stop program = "/etc/init.d/hhvm_{SYSTEM_USER} stop"
\ No newline at end of file
#!/bin/bash
#
# /etc/init.d/hhvm_{SYSTEM_USER}
#
### BEGIN INIT INFO
# Provides: hhvm_{SYSTEM_USER}
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Starts The HHVM FastCGI Daemon
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="HHVM FastCGI Daemon"
NAME=hhvm
do_start()
{
if [ ! -d /var/run/hhvm ]; then
mkdir -p -m1777 /var/run/hhvm
else
chmod 1777 /var/run/hhvm
fi
if [[ -e "/var/run/hhvm/hhvm_{SYSTEM_USER}.pid" ]] ; then
kill -0 `cat /var/run/hhvm/hhvm_{SYSTEM_USER}.pid` >/dev/null 2>&1 ;
case "$?" in
0)
return 1
;;
esac
fi
if [[ -S /var/run/mysqld/mysqld.sock && ! -S /tmp/mysql.sock ]] ; then
ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock ;
fi
umask 027
sudo -u {SYSTEM_USER} touch /var/run/hhvm/hhvm_{SYSTEM_USER}.pid
BASEINIFILE=""
if [[ -e "/etc/hhvm/php.ini" ]] ; then
BASEINIFILE="--config /etc/hhvm/php.ini" ;
fi
INIFILE=""
if [[ -e "/var/www/conf/{SYSTEM_USER}/php.ini" ]] ; then
INIFILE="--config /var/www/conf/{SYSTEM_USER}/php.ini" ;
elif [[ -e "/etc/php5/hhvm/php.ini" ]] ; then
INIFILE="--config /etc/php5/hhvm/php.ini" ;
elif [[ -e "/etc/php5/fpm/php.ini" ]] ; then
INIFILE="--config /etc/php5/fpm/php.ini" ;
elif [[ -e "/etc/php5/cgi/php.ini" ]] ; then
INIFILE="--config /etc/php5/cgi/php.ini" ;
fi
CUSTOMINIFILE=""
if [[ -e "/etc/hhvm/{SYSTEM_USER}.ini" ]] ; then
CUSTOMINIFILE="--config /etc/hhvm/{SYSTEM_USER}.ini" ;
fi
/usr/bin/hhvm --mode daemon -vServer.Type=fastcgi -vEval.PerfPidMap=false --user {SYSTEM_USER} -vServer.FileSocket=/var/run/hhvm/hhvm.{SYSTEM_USER}.sock -vLog.Level=Warning -vLog.UseLogFile=false -vRepo.Central.Path=/var/run/hhvm/hhvm.{SYSTEM_USER}.hhbc -vServer.FixPathInfo=true $BASEINIFILE $INIFILE $CUSTOMINIFILE -vPidFile=/var/run/hhvm/hhvm_{SYSTEM_USER}.pid & echo $! > /var/run/hhvm/hhvm_{SYSTEM_USER}.pid
}
do_stop()
{
if [[ -e "/var/run/hhvm/hhvm_{SYSTEM_USER}.pid" ]] ; then
kill -SIGTERM `cat /var/run/hhvm/hhvm_{SYSTEM_USER}.pid` >/dev/null 2>&1 ;
fi
rm -f /var/run/hhvm/hhvm.{SYSTEM_USER}.sock /var/run/hhvm/hhvm.{SYSTEM_USER}.hhbc /var/run/hhvm/hhvm_{SYSTEM_USER}.pid
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
restart|force-reload)
do_stop
case "$?" in
0|1)
do_start
;;
*)
;;
esac
;;
*)
exit 3
;;
esac
:
......@@ -201,44 +201,9 @@ server {
fastcgi_intercept_errors on;
}
</tmpl_else>
<tmpl_if name='php' op='==' value='hhvm'>
location @php {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/hhvm/hhvm.<tmpl_var name='system_user'>.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param PATH_INFO $fastcgi_script_name;
<tmpl_if name='seo_redirect_enabled'>
fastcgi_param SERVER_NAME <tmpl_var name='seo_redirect_target_domain'>;
</tmpl_if>
fastcgi_intercept_errors on;
error_page 500 501 502 503 = @phpfallback;
}
location @phpfallback {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
<tmpl_if name='use_tcp'>
fastcgi_pass 127.0.0.1:<tmpl_var name='fpm_port'>;
</tmpl_if>
<tmpl_if name='use_socket'>
fastcgi_pass unix:<tmpl_var name='fpm_socket'>;
</tmpl_if>
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param PATH_INFO $fastcgi_script_name;
<tmpl_if name='seo_redirect_enabled'>
fastcgi_param SERVER_NAME <tmpl_var name='seo_redirect_target_domain'>;
</tmpl_if>
fastcgi_intercept_errors on;
}
</tmpl_else>
location @php {
deny all;
}
</tmpl_if>
</tmpl_if>
<tmpl_if name='cgi' op='==' value='y'>
......
......@@ -19,22 +19,10 @@
</tmpl_if>
</tmpl_if>
<tmpl_if name='php' op='==' value='suphp'>
DocumentRoot <tmpl_var name='web_document_root'>
<tmpl_if name='php' op='==' value='php-fpm'>
DocumentRoot <tmpl_var name='web_document_root'>
</tmpl_else>
<tmpl_if name='php' op='==' value='cgi'>
DocumentRoot <tmpl_var name='web_document_root'>
</tmpl_else>
<tmpl_if name='php' op='==' value='php-fpm'>
DocumentRoot <tmpl_var name='web_document_root'>
</tmpl_else>
<tmpl_if name='php' op='==' value='hhvm'>
DocumentRoot <tmpl_var name='web_document_root'>
</tmpl_else>
DocumentRoot <tmpl_var name='web_document_root_www'>
</tmpl_if>
</tmpl_if>
</tmpl_if>
DocumentRoot <tmpl_var name='web_document_root_www'>
</tmpl_if>
ServerName <tmpl_var name='domain'>
......@@ -253,45 +241,6 @@
php_admin_value open_basedir <tmpl_var name='php_open_basedir'>
</tmpl_if>
</tmpl_if>
<tmpl_if name='php' op='==' value='suphp'>
# suphp enabled
<Directory {tmpl_var name='web_document_root'}>
<IfModule mod_suphp.c>
suPHP_Engine on
# suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>
<tmpl_if name='has_custom_php_ini'>
suPHP_ConfigPath <tmpl_var name='custom_php_ini_dir'>
</tmpl_if>
<FilesMatch "\.php[345]?$">
SetHandler x-httpd-suphp
</FilesMatch>
suPHP_AddHandler x-httpd-suphp
</IfModule>
</Directory>
</tmpl_if>
<tmpl_if name='php' op='==' value='cgi'>
# php as cgi enabled
ScriptAlias /php-cgi <tmpl_var name='cgi_starter_path'><tmpl_var name='cgi_starter_script'>
Action php-cgi /php-cgi
<Directory {tmpl_var name='web_document_root_www'}>
<FilesMatch "\.php[345]?$">
SetHandler php-cgi
</FilesMatch>
</Directory>
<Directory {tmpl_var name='web_document_root'}>
<FilesMatch "\.php[345]?$">
SetHandler php-cgi
</FilesMatch>
</Directory>
<Directory {tmpl_var name='cgi_starter_path'}>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
</tmpl_if>
<tmpl_if name='php' op='==' value='fast-cgi'>
# php as fast-cgi enabled
# For config options see: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
......@@ -426,64 +375,6 @@
</IfModule>
</tmpl_if>
<tmpl_if name='php' op='==' value='hhvm'>
<IfModule mod_fastcgi.c>
<Directory {tmpl_var name='document_root'}/cgi-bin>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
<Directory {tmpl_var name='web_document_root_www'}>
<FilesMatch "\.php[345]?$">
SetHandler hhvm-fcgi
</FilesMatch>
<FilesMatch "\.hh$">
SetHandler hhvm-fcgi
</FilesMatch>
</Directory>
<Directory {tmpl_var name='web_document_root'}>
<FilesMatch "\.php[345]?$">
SetHandler hhvm-fcgi
</FilesMatch>
<FilesMatch "\.hh$">
SetHandler hhvm-fcgi
</FilesMatch>
</Directory>
Action hhvm-fcgi /hhvm-fcgi virtual
Alias /hhvm-fcgi {tmpl_var name='document_root'}/cgi-bin/hhvm-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'}
FastCgiExternalServer {tmpl_var name='document_root'}/cgi-bin/hhvm-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'} -idle-timeout 300 -socket /var/run/hhvm/hhvm.<tmpl_var name='system_user'>.sock -pass-header Authorization -pass-header Content-Type
</IfModule>
<IfModule mod_proxy_fcgi.c>
<Directory {tmpl_var name='document_root'}/cgi-bin>
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
Require all granted
<tmpl_else>
Order allow,deny
Allow from all
</tmpl_if>
</Directory>
<Directory {tmpl_var name='web_document_root'}>
<FilesMatch "\.php[345]?$">
SetHandler "proxy:unix:/var/run/hhvm/hhvm.<tmpl_var name='system_user'>.sock|fcgi://localhost"
</FilesMatch>
<FilesMatch "\.hh$">
SetHandler "proxy:unix:/var/run/hhvm/hhvm.<tmpl_var name='system_user'>.sock|fcgi://localhost"
</FilesMatch>
</Directory>
<Directory {tmpl_var name='web_document_root_www'}>
<FilesMatch "\.php[345]?$">
SetHandler "proxy:unix:/var/run/hhvm/hhvm.<tmpl_var name='system_user'>.sock|fcgi://localhost"
</FilesMatch>
<FilesMatch "\.hh$">
SetHandler "proxy:unix:/var/run/hhvm/hhvm.<tmpl_var name='system_user'>.sock|fcgi://localhost"
</FilesMatch>
</Directory>
</IfModule>
</tmpl_if>
<tmpl_if name="rewrite_enabled">
RewriteEngine on
<tmpl_if name='apache_version' op='>' value='2.2' format='version'>
......
......@@ -159,7 +159,7 @@ class apache2_plugin {
/* $data contains an array with these keys:
* file -> full path of changed php_ini
* mode -> web_domain php modes to change (mod, fast-cgi, php-fpm, hhvm or '' for all except 'mod')
* mode -> web_domain php modes to change (mod, fast-cgi, php-fpm or '' for all except 'mod')
* php_version -> php ini path that changed (additional php versions)
*/
......@@ -179,12 +179,6 @@ class apache2_plugin {
$qrystr .= " AND fastcgi_php_version LIKE ?";
$param = '%:' . $data['php_version'] . ':%';
}
} elseif($data['mode'] == 'hhvm') {
$qrystr .= " AND php = 'hhvm'";
if($data['php_version']) {
$qrystr .= " AND fastcgi_php_version LIKE ?";
$param = '%:' . $data['php_version'] . ':%';
}
} else {
$qrystr .= " AND php != 'mod' AND php != 'fast-cgi'";
}
......@@ -1099,11 +1093,6 @@ class apache2_plugin {
if($data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias') $custom_php_ini_dir .= '_' . $web_folder;
if(!is_dir($web_config['website_basedir'].'/conf')) $app->system->mkdir($web_config['website_basedir'].'/conf');
//* add open_basedir restriction to custom php.ini content, required for suphp only
if(!stristr($data['new']['custom_php_ini'], 'open_basedir') && $data['new']['php'] == 'suphp') {
$data['new']['custom_php_ini'] .= "\nopen_basedir = '".$data['new']['php_open_basedir']."'\n";
}
$fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi');
if(trim($data['new']['fastcgi_php_version']) != ''){
......@@ -1550,7 +1539,7 @@ class apache2_plugin {
$default_php_fpm = true;
}
} else {
if(trim($data['old']['fastcgi_php_version']) != '' && ($data['old']['php'] == 'php-fpm' || $data['old']['php'] == 'hhvm')){
if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){
$default_php_fpm = false;
list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
......@@ -1823,7 +1812,6 @@ class apache2_plugin {
}
$this->php_fpm_pool_update($data, $web_config, $pool_dir, $pool_name, $socket_dir);
$this->hhvm_update($data, $web_config);
if($web_config['check_apache_config'] == 'y') {
//* Test if apache starts with the new configuration file
......@@ -2143,8 +2131,6 @@ class apache2_plugin {
// remove PHP-FPM pool
if ($data['old']['php'] == 'php-fpm') {
$this->php_fpm_pool_delete($data, $web_config);
} elseif($data['old']['php'] == 'hhvm') {
$this->hhvm_update($data, $web_config);
}
//remove the php cgi starter script if available
......@@ -2895,84 +2881,6 @@ class apache2_plugin {
}
}
private function hhvm_update($data, $web_config) {
global $app, $conf;
if(file_exists($conf['rootpath'] . '/conf-custom/hhvm_starter.master')) {
$content = file_get_contents($conf['rootpath'] . '/conf-custom/hhvm_starter.master');
} else {
$content = file_get_contents($conf['rootpath'] . '/conf/hhvm_starter.master');
}
if(file_exists($conf['rootpath'] . '/conf-custom/hhvm_monit.master')) {
$monit_content = file_get_contents($conf['rootpath'] . '/conf-custom/hhvm_monit.master');
} else {
$monit_content = file_get_contents($conf['rootpath'] . '/conf/hhvm_monit.master');
}
if($data['new']['php'] == 'hhvm' && $data['old']['php'] != 'hhvm' || ($data['new']['php'] == 'hhvm' && isset($data['old']['custom_php_ini']) && $data['new']['custom_php_ini'] != $data['old']['custom_php_ini'])) {
// Custom php.ini settings
$custom_php_ini_settings = trim($data