diff --git a/server/conf/php_fpm_pool.conf.master b/server/conf/php_fpm_pool.conf.master index 88b9e2b639838e2e3ca61ad07a1ab2dad946a72c..f2417e87bba0dbc2388645105fd6e88ba96daf7c 100644 --- a/server/conf/php_fpm_pool.conf.master +++ b/server/conf/php_fpm_pool.conf.master @@ -44,8 +44,10 @@ env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin php_admin_value[session.save_path] = <tmpl_var name='document_root'>/tmp </tmpl_if> php_admin_value[upload_tmp_dir] = <tmpl_var name='document_root'>/tmp +<tmpl_if name='custom_sendmail_path' op='!=' value='y'> php_admin_value[sendmail_path] = "/usr/sbin/sendmail -t -i -f webmaster@<tmpl_var name='domain'>" </tmpl_if> +</tmpl_if> <tmpl_loop name="custom_php_ini_settings"> <tmpl_var name='ini_setting'> diff --git a/server/conf/vhost.conf.master b/server/conf/vhost.conf.master index 692257848cb8a4ab440718b549a3c86025ffc780..aafb3fcb5af42bbc8ad8e469f8d693be6d3604be 100644 --- a/server/conf/vhost.conf.master +++ b/server/conf/vhost.conf.master @@ -252,7 +252,9 @@ SetEnv TMP <tmpl_var name='document_root'>/tmp SetEnv TMPDIR <tmpl_var name='document_root'>/tmp SetEnv TEMP <tmpl_var name='document_root'>/tmp + <tmpl_if name='custom_sendmail_path' op='!=' value='y'> php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -fwebmaster@<tmpl_var name='domain'>" + </tmpl_if> php_admin_value upload_tmp_dir <tmpl_var name='document_root'>/tmp php_admin_value session.save_path <tmpl_var name='document_root'>/tmp # PHPIniDir <tmpl_var name='custom_php_ini_dir'> diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index f6403b79698e1bdb13dc6900df0805750f5f8782..882b39903a9a5a56ee40ba55f4343b6f4627514c 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -1176,6 +1176,7 @@ class apache2_plugin { //* Create custom php.ini if(trim($data['new']['custom_php_ini']) != '') { $has_custom_php_ini = true; + $custom_sendmail_path = false; if(!is_dir($custom_php_ini_dir)) $app->system->mkdirpath($custom_php_ini_dir); $php_ini_content = $this->get_master_php_ini_content($data['new']); @@ -1200,6 +1201,13 @@ class apache2_plugin { } } + $custom_sendmail_path = false; + $line = strtok($php_ini_content, '\n'); + while ($line !== false) { + if (strpos($line, 'sendmail_path') === 0) $custom_sendmail_path = true; + $line = strtok('\n'); + } + $app->system->file_put_contents($custom_php_ini_dir.'/php.ini', $php_ini_content); } else { $has_custom_php_ini = false; @@ -1244,7 +1252,7 @@ class apache2_plugin { $trans = array( '{DOCROOT}' => $vhost_data['web_document_root_www'], '{DOCROOT_CLIENT}' => $vhost_data['web_document_root'], - '{DOMAIN}' => $vhost_data['domain'] + '{DOMAIN}' => $vhost_data['domain'] ); $vhost_data['apache_directives'] = strtr($vhost_data['apache_directives'], $trans); @@ -1309,6 +1317,8 @@ class apache2_plugin { $vhost_data['seo_redirect_enabled'] = 0; } + $vhost_data['custom_sendmail_path'] = (isset($custom_sendmail_path) && $custom_sendmail_path) ? 'y' : 'n'; + $tpl->setVar($vhost_data); $tpl->setVar('apache_version', $app->system->getapacheversion()); @@ -3366,6 +3376,7 @@ class apache2_plugin { } $custom_session_save_path = false; + $custom_sendmail_path = false; if($custom_php_ini_settings != ''){ // Make sure we only have Unix linebreaks $custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings); @@ -3383,6 +3394,7 @@ class apache2_plugin { if($value != ''){ $key = trim($key); if($key == 'session.save_path') $custom_session_save_path = true; + if($key == 'sendmail_path') $custom_sendmail_path = true; switch (strtolower($value)) { case '0': // PHP-FPM might complain about invalid boolean value if you use 0 @@ -3405,6 +3417,7 @@ class apache2_plugin { } $tpl->setVar('custom_session_save_path', ($custom_session_save_path ? 'y' : 'n')); + $tpl->setVar('custom_sendmail_path', ($custom_sendmail_path ? 'y' : 'n')); $tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings); diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index 590e5baf3e91c97159cd54553862a15f148483cc..28611ce1784b42983f8f1eeb2fd4e1b91fd6caa9 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -2954,6 +2954,7 @@ class nginx_plugin { } $custom_session_save_path = false; + $custom_sendmail_path = false; if($custom_php_ini_settings != ''){ // Make sure we only have Unix linebreaks $custom_php_ini_settings = str_replace("\r\n", "\n", $custom_php_ini_settings); @@ -2971,6 +2972,7 @@ class nginx_plugin { if($value != ''){ $key = trim($key); if($key == 'session.save_path') $custom_session_save_path = true; + if($key == 'sendmail_path') $custom_sendmail_path = true; switch (strtolower($value)) { case '0': // PHP-FPM might complain about invalid boolean value if you use 0 @@ -2993,6 +2995,7 @@ class nginx_plugin { } $tpl->setVar('custom_session_save_path', ($custom_session_save_path ? 'y' : 'n')); + $tpl->setVar('custom_sendmail_path', ($custom_sendmail_path ? 'y' : 'n')); $tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings);