diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 350ae05f9da7a166ca1a1f521981e668e86c3849..e242c6429fe3170e8ba48408100f2207d520c518 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -944,7 +944,7 @@ class installer_base {
exec('mkdir -p /var/log/ispconfig/httpd');
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','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=0077','umask=0022',0);
}
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index 2a8800363bb93d7a356a6c160c708b2fd44ed9ef..504886bed21a187a62806f70f3e7f12b4a16a443 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -1084,6 +1084,7 @@ CREATE TABLE `web_domain` (
`allow_override` varchar(255) NOT NULL default 'All',
`apache_directives` text,
`php_open_basedir` text,
+ `custom_php_ini` text,
`backup_interval` VARCHAR( 255 ) NOT NULL DEFAULT 'none',
`backup_copies` INT NOT NULL DEFAULT '1',
`active` enum('n','y') NOT NULL default 'y',
diff --git a/install/tpl/server.ini.master b/install/tpl/server.ini.master
index d5584ba895b1d648102d63e284befc360f2a67e3..01fcd80ff98f6c3e6b5c7406e586aa0279e42229 100644
--- a/install/tpl/server.ini.master
+++ b/install/tpl/server.ini.master
@@ -51,6 +51,8 @@ awstats_conf_dir=/etc/awstats
awstats_data_dir=/var/lib/awstats
awstats_pl=/usr/lib/cgi-bin/awstats.pl
awstats_buildstaticpages_pl=/usr/share/awstats/tools/awstats_buildstaticpages.pl
+php_ini_path_apache=/etc/php5/apache2/php.ini
+php_ini_path_cgi=/etc/php5/cgi/php.ini
[dns]
bind_user=root
diff --git a/interface/web/admin/form/server_config.tform.php b/interface/web/admin/form/server_config.tform.php
index cf43c9a3515a4b10efc8617052b12fdceddb7fba..585a1206750f6902fd92e4b4d57c8392b34f5ecd 100644
--- a/interface/web/admin/form/server_config.tform.php
+++ b/interface/web/admin/form/server_config.tform.php
@@ -398,6 +398,28 @@ $form["tabs"]['web'] = array (
'width' => '40',
'maxlength' => '255'
),
+ 'php_ini_path_apache' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'default' => '',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'php_ini_path_apache_error_empty'),
+ ),
+ 'value' => '',
+ 'width' => '40',
+ 'maxlength' => '255'
+ ),
+ 'php_ini_path_cgi' => array (
+ 'datatype' => 'VARCHAR',
+ 'formtype' => 'TEXT',
+ 'default' => '',
+ 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+ 'errmsg'=> 'php_ini_path_cgi_error_empty'),
+ ),
+ 'value' => '',
+ 'width' => '40',
+ 'maxlength' => '255'
+ ),
'php_open_basedir' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
diff --git a/interface/web/admin/lib/lang/en_server_config.lng b/interface/web/admin/lib/lang/en_server_config.lng
index af703c4fde112b382415e16d1ab68a3962e4beae..bacf38ddc2fa85fb7ccbd64aa0d41cd14b23bc9b 100644
--- a/interface/web/admin/lib/lang/en_server_config.lng
+++ b/interface/web/admin/lib/lang/en_server_config.lng
@@ -70,4 +70,7 @@ $wb["awstats_data_dir_txt"] = 'awstats data folder';
$wb["awstats_pl_txt"] = 'awstats.pl script';
$wb["awstats_buildstaticpages_pl_txt"] = 'awstats_buildstaticpages.pl script';
$wb["backup_dir_txt"] = 'Backup directory';
+$wb["named_conf_local_path_txt"] = 'BIND named.conf.local path';
+$wb["php_ini_path_cgi_txt"] = 'CGI php.ini path';
+$wb["php_ini_path_apache_txt"] = 'Apache php.ini path';
?>
\ No newline at end of file
diff --git a/interface/web/admin/templates/server_config_web_edit.htm b/interface/web/admin/templates/server_config_web_edit.htm
index d08d032c46880f50934dd17fb8d687c9cf953663..68c57bd97cdfe6ab1bd581b235f95a5bdddc20bf 100644
--- a/interface/web/admin/templates/server_config_web_edit.htm
+++ b/interface/web/admin/templates/server_config_web_edit.htm
@@ -42,6 +42,14 @@
+
+
+
+
+
+
+
+
diff --git a/interface/web/sites/form/web_domain.tform.php b/interface/web/sites/form/web_domain.tform.php
index ce76b690ad737f032ee2e28fb93f282d1a3f2453..a21a4850d8ac8b331f64e00f3334c52778142f43 100644
--- a/interface/web/sites/form/web_domain.tform.php
+++ b/interface/web/sites/form/web_domain.tform.php
@@ -487,6 +487,14 @@ $form["tabs"]['advanced'] = array (
'width' => '30',
'maxlength' => '255'
),
+ 'custom_php_ini' => array (
+ 'datatype' => 'TEXT',
+ 'formtype' => 'TEXT',
+ 'default' => '',
+ 'value' => '',
+ 'width' => '30',
+ 'maxlength' => '255'
+ ),
'apache_directives' => array (
'datatype' => 'TEXT',
'formtype' => 'TEXT',
diff --git a/interface/web/sites/lib/lang/en_web_domain.lng b/interface/web/sites/lib/lang/en_web_domain.lng
index d20f1b9efd8586ec53e0bff3ae3e8c3f1d3d9d42..79438c8558ac1ff79275c856ce58d741736912b2 100644
--- a/interface/web/sites/lib/lang/en_web_domain.lng
+++ b/interface/web/sites/lib/lang/en_web_domain.lng
@@ -49,7 +49,7 @@ $wb["error_ssl_organisation_unit_empty"] = 'SSL Organisation Unit is empty.';
$wb["error_ssl_country_empty"] = 'SSL Country is empty.';
$wb["client_group_id_txt"] = 'Client';
$wb["stats_password_txt"] = 'Webstatistics password';
-$wb["allow_override_txt"] = 'Allow Override';
+$wb["allow_override_txt"] = 'Apache AllowOverride';
$wb["limit_web_quota_free_txt"] = 'Max. available Harddisk Quota';
$wb["ssl_state_error_regex"] = 'Invalid SSL State. Valid characters are: a-z, 0-9 and .,-_';
$wb["ssl_locality_error_regex"] = 'Invalid SSL Locality. Valid characters are: a-z, 0-9 and .,-_';
@@ -63,4 +63,5 @@ $wb["traffic_quota_exceeded_txt"] = 'Traffic quota exceeded';
$wb["ruby_txt"] = 'Ruby';
$wb["stats_user_txt"] = 'Webstatistics username';
$wb["stats_type_txt"] = 'Webstatistics program';
+$wb["custom_php_ini_txt"] = 'Custom php.ini settings';
?>
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_domain_advanced.htm b/interface/web/sites/templates/web_domain_advanced.htm
index a9b9d026493c51ba9de1b6b9b8ea840ce70eb28e..f00b3dad9790074c7ce171e9f557fe6ed98713f1 100644
--- a/interface/web/sites/templates/web_domain_advanced.htm
+++ b/interface/web/sites/templates/web_domain_advanced.htm
@@ -22,12 +22,16 @@
-
+
+
+
+
+
-
-
+
+
diff --git a/server/conf/php-cgi-starter.master b/server/conf/php-cgi-starter.master
index 3c00f9dba86d13dd721a0d72c4595f36daaaaefc..be309932210ff16b8540e960b208a8562db50a77 100644
--- a/server/conf/php-cgi-starter.master
+++ b/server/conf/php-cgi-starter.master
@@ -1,5 +1,9 @@
#!/bin/sh
+
+export PHPRC=""
+
+
exec \
-d open_basedir= \
-d upload_tmp_dir=/tmp \
diff --git a/server/conf/vhost.conf.master b/server/conf/vhost.conf.master
index 1a12fa8cd4729c842c391904fd37261232bc0f8d..d6f33a97c12ad40e312e378aaf7ad241cfe46419 100644
--- a/server/conf/vhost.conf.master
+++ b/server/conf/vhost.conf.master
@@ -118,6 +118,7 @@
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -fwebmaster@"
php_admin_value upload_tmp_dir /tmp
php_admin_value session.save_path /tmp
+ PHPIniDir
php_admin_value open_basedir
@@ -127,6 +128,9 @@
suPHP_Engine on
# suPHP_UserGroup
+
+ suPHP_ConfigPath
+
AddHandler x-httpd-suphp .php .php3 .php4 .php5
suPHP_AddHandler x-httpd-suphp
@@ -305,6 +309,7 @@
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -fwebmaster@"
php_admin_value upload_tmp_dir /tmp
php_admin_value session.save_path /tmp
+ PHPIniDir
php_admin_value open_basedir
@@ -312,6 +317,9 @@
suPHP_Engine on
# suPHP_UserGroup
+
+ suPHP_ConfigPath
+
AddHandler x-httpd-suphp .php .php3 .php4 .php5
suPHP_AddHandler x-httpd-suphp
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index c0fd8223e90878861ac8cde78b09b93a6299ae5b..2f106ef5f3b73aa4c4aadfb38aaddb329ce68440 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -543,7 +543,30 @@ class apache2_plugin {
$this->_exec("chown $username:$groupname ".escapeshellcmd($data["new"]["document_root"])."/log/error.log");
- // Create the vhost config file
+ //* Write the custom php.ini file, if custom_php_ini filed is not empty
+ $custom_php_ini_dir = $web_config['website_basedir'].'/conf/'.$data["new"]["system_user"];
+ if(!is_dir($web_config['website_basedir'].'/conf')) mkdir($web_config['website_basedir'].'/conf');
+ if(trim($data["new"]['custom_php_ini']) != '') {
+ $has_custom_php_ini = true;
+ if(!is_dir($custom_php_ini_dir)) mkdir($custom_php_ini_dir);
+ $php_ini_content = '';
+ if($data["new"]['php'] == 'mod') {
+ $master_php_ini_path = $web_config['php_ini_path_apache'];
+ } else {
+ $master_php_ini_path = $web_config['php_ini_path_cgi'];
+ }
+ if($master_php_ini_path != '' && substr($master_php_ini_path,-7) == 'php.ini' && is_file($master_php_ini_path)) {
+ $php_ini_content .= file_get_contents($master_php_ini_path)."\n";
+ }
+ $php_ini_content .= trim($data["new"]['custom_php_ini']);
+ file_put_contents($custom_php_ini_dir.'/php.ini',$php_ini_content);
+ } else {
+ $has_custom_php_ini = false;
+ if(is_file($custom_php_ini_dir.'/php.ini')) unlink($custom_php_ini_dir.'/php.ini');
+ }
+
+
+ //* Create the vhost config file
$app->load('tpl');
$tpl = new tpl();
@@ -557,6 +580,8 @@ class apache2_plugin {
$vhost_data["allow_override"] = ($data["new"]["allow_override"] == '')?'All':$data["new"]["allow_override"];
$vhost_data["php_open_basedir"] = ($data["new"]["php_open_basedir"] == '')?$data["new"]["document_root"]:$data["new"]["php_open_basedir"];
$vhost_data["ssl_domain"] = $data["new"]["ssl_domain"];
+ $vhost_data["has_custom_php_ini"] = $has_custom_php_ini;
+ $vhost_data["custom_php_ini_dir"] = escapeshellcmd($custom_php_ini_dir);
// Check if a SSL cert exists
$ssl_dir = $data["new"]["document_root"]."/ssl";
@@ -709,8 +734,12 @@ class apache2_plugin {
$fcgi_tpl = new tpl();
$fcgi_tpl->newTemplate("php-fcgi-starter.master");
-
- $fcgi_tpl->setVar('php_ini_path',escapeshellcmd($fastcgi_config["fastcgi_phpini_path"]));
+
+ if($has_custom_php_ini) {
+ $fcgi_tpl->setVar('php_ini_path',escapeshellcmd($custom_php_ini_dir));
+ } else {
+ $fcgi_tpl->setVar('php_ini_path',escapeshellcmd($fastcgi_config["fastcgi_phpini_path"]));
+ }
$fcgi_tpl->setVar('document_root',escapeshellcmd($data["new"]["document_root"]));
$fcgi_tpl->setVar('php_fcgi_children',escapeshellcmd($fastcgi_config["fastcgi_children"]));
$fcgi_tpl->setVar('php_fcgi_max_requests',escapeshellcmd($fastcgi_config["fastcgi_max_requests"]));
@@ -772,6 +801,13 @@ class apache2_plugin {
//$cgi_tpl->setVar('open_basedir', "/var/www/" . $data["new"]["domain"]);
$cgi_tpl->setVar('php_cgi_bin',$cgi_config["cgi_bin"]);
$cgi_tpl->setVar('security_level',$web_config["security_level"]);
+
+ $cgi_tpl->setVar('has_custom_php_ini',$has_custom_php_ini);
+ if($has_custom_php_ini) {
+ $cgi_tpl->setVar('php_ini_path',escapeshellcmd($custom_php_ini_dir));
+ } else {
+ $cgi_tpl->setVar('php_ini_path',escapeshellcmd($fastcgi_config["fastcgi_phpini_path"]));
+ }
$cgi_starter_script = escapeshellcmd($cgi_starter_path.$cgi_config["cgi_starter_script"]);
file_put_contents($cgi_starter_script,$cgi_tpl->grab());