Skip to content

Commit add36e9

Browse files
committed
- Added open_basedir support to PHP-FPM.
1 parent 4ffb51e commit add36e9

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

interface/web/admin/templates/server_config_web_edit.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ <h2><tmpl_var name="list_head_txt"></h2>
8989
<label for="php_ini_path_apache">{tmpl_var name='php_ini_path_apache_txt'}</label>
9090
<input name="php_ini_path_apache" id="php_ini_path_apache" value="{tmpl_var name='php_ini_path_apache'}" size="40" maxlength="255" type="text" class="textInput" />
9191
</div>
92-
<div class="ctrlHolder">
92+
<div class="ctrlHolder apache">
9393
<label for="php_ini_path_cgi">{tmpl_var name='php_ini_path_cgi_txt'}</label>
9494
<input name="php_ini_path_cgi" id="php_ini_path_cgi" value="{tmpl_var name='php_ini_path_cgi'}" size="40" maxlength="255" type="text" class="textInput" />
9595
</div>

server/conf/php_fpm_pool.conf.master

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ pm.start_servers = 20
1111
pm.min_spare_servers = 5
1212
pm.max_spare_servers = 35
1313

14-
chdir = /
14+
chdir = /
15+
16+
<tmpl_var name='enable_php_open_basedir'>php_admin_value[open_basedir] = <tmpl_var name='php_open_basedir'>

server/plugins-available/nginx_plugin.inc.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,6 @@ function update($event_name,$data) {
640640
$vhost_data['web_basedir'] = $web_config['website_basedir'];
641641
$vhost_data['security_level'] = $web_config['security_level'];
642642
$vhost_data['allow_override'] = ($data['new']['allow_override'] == '')?'All':$data['new']['allow_override'];
643-
//$vhost_data['php_open_basedir'] = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir'];
644643
$vhost_data['ssl_domain'] = $data['new']['ssl_domain'];
645644
//$vhost_data['has_custom_php_ini'] = $has_custom_php_ini;
646645
//$vhost_data['custom_php_ini_dir'] = escapeshellcmd($custom_php_ini_dir);
@@ -1082,6 +1081,13 @@ private function php_fpm_pool_update ($data,$web_config) {
10821081
$tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id']);
10831082
$tpl->setVar('fpm_user', $data['new']['system_user']);
10841083
$tpl->setVar('fpm_group', $data['new']['system_group']);
1084+
$php_open_basedir = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir'];
1085+
$tpl->setVar('php_open_basedir', $php_open_basedir);
1086+
if($php_open_basedir != ''){
1087+
$tpl->setVar('enable_php_open_basedir', '');
1088+
} else {
1089+
$tpl->setVar('enable_php_open_basedir', ';');
1090+
}
10851091

10861092
file_put_contents($pool_dir.'/'.$data['new']['domain'].'.conf',$tpl->grab());
10871093
$app->log('Writing the PHP-FPM config file: '.$pool_dir.'/'.$data['new']['domain'].'.conf',LOGLEVEL_DEBUG);

0 commit comments

Comments
 (0)