Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Zvonimir
ISPConfig 3
Commits
62b385fc
Commit
62b385fc
authored
Mar 06, 2012
by
Falko Timme
Browse files
- Added support for multiple PHP versions (Apache + PHP-FastCGI).
parent
0732d32f
Changes
14
Hide whitespace changes
Inline
Side-by-side
install/sql/incremental/upd_0031.sql
0 → 100644
View file @
62b385fc
ALTER
TABLE
`web_domain`
ADD
`fastcgi_php_version`
VARCHAR
(
255
)
NULL
DEFAULT
NULL
;
\ No newline at end of file
install/sql/ispconfig3.sql
View file @
62b385fc
...
...
@@ -1549,6 +1549,7 @@ CREATE TABLE `web_domain` (
`backup_copies`
INT
NOT
NULL
DEFAULT
'1'
,
`active`
enum
(
'n'
,
'y'
)
NOT
NULL
default
'y'
,
`traffic_quota_lock`
enum
(
'n'
,
'y'
)
NOT
NULL
default
'n'
,
`fastcgi_php_version`
varchar
(
255
)
DEFAULT
NULL
,
PRIMARY
KEY
(
`domain_id`
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
utf8
AUTO_INCREMENT
=
1
;
...
...
install/tpl/server.ini.master
View file @
62b385fc
...
...
@@ -90,6 +90,7 @@ fastcgi_children=8
fastcgi_max_requests=5000
fastcgi_bin=/usr/bin/php-cgi
fastcgi_config_syntax=1
fastcgi_additional_php_versions=
[jailkit]
jailkit_chroot_home=/home/[username]
...
...
interface/web/admin/form/server_config.tform.php
View file @
62b385fc
...
...
@@ -867,6 +867,14 @@ $form["tabs"]['fastcgi'] = array(
'width'
=>
'40'
,
'maxlength'
=>
'255'
),
'fastcgi_additional_php_versions'
=>
array
(
'datatype'
=>
'VARCHAR'
,
'formtype'
=>
'TEXT'
,
'default'
=>
''
,
'value'
=>
''
,
'width'
=>
'30'
,
'maxlength'
=>
'255'
),
##################################
# ENDE Datatable fields
##################################
...
...
interface/web/admin/lib/lang/de_server_config.lng
View file @
62b385fc
...
...
@@ -153,4 +153,6 @@ $wb['set_folder_permissions_on_update_txt'] = 'Set folder permissions on update'
$wb
[
'add_web_users_to_sshusers_group_txt'
]
=
'Add web users to -sshusers- group'
;
$wb
[
'connect_userid_to_webid_txt'
]
=
'Connect Linux userid to webid'
;
$wb
[
'connect_userid_to_webid_start_txt'
]
=
'Start ID for userid/webid connect'
;
$wb
[
"fastcgi_additional_php_versions_txt"
]
=
'Zusätzliche PHP-Versionen'
;
$wb
[
"fastcgi_additional_php_versions_hint_txt"
]
=
'Format:<br><name>;<path_to_executable>;<path_to_php.ini_dir><br>z.B.:<br>PHP 5.2.17;/opt/php52/bin/php-cgi;/opt/php52/etc/'
;
?>
interface/web/admin/lib/lang/en_server_config.lng
View file @
62b385fc
...
...
@@ -157,4 +157,6 @@ $wb["connect_userid_to_webid_txt"] = 'Connect Linux userid to webid';
$wb
[
"connect_userid_to_webid_start_txt"
]
=
'Start ID for userid/webid connect'
;
$wb
[
"realtime_blackhole_list_txt"
]
=
'Real-time Blackhole List'
;
$wb
[
"realtime_blackhole_list_note_txt"
]
=
'(Separate RBL\'s with commas)'
;
$wb
[
"fastcgi_additional_php_versions_txt"
]
=
'Additional PHP Versions'
;
$wb
[
"fastcgi_additional_php_versions_hint_txt"
]
=
'Format:<br><name>;<path_to_executable>;<path_to_php.ini_dir><br>e.g.:<br>PHP 5.2.17;/opt/php52/bin/php-cgi;/opt/php52/etc/'
;
?>
\ No newline at end of file
interface/web/admin/templates/server_config_fastcgi_edit.htm
View file @
62b385fc
...
...
@@ -39,6 +39,10 @@
{tmpl_var name='fastcgi_config_syntax'}
</select>
</div>
<div
class=
"ctrlHolder"
>
<label
for=
"fastcgi_additional_php_versions"
>
{tmpl_var name='fastcgi_additional_php_versions_txt'}
</label>
<textarea
rows=
"10"
cols=
"40"
name=
"fastcgi_additional_php_versions"
id=
"fastcgi_additional_php_versions"
type=
"text"
class=
"textInput"
>
{tmpl_var name='fastcgi_additional_php_versions'}
</textarea>
{tmpl_var name='fastcgi_additional_php_versions_hint_txt'}
</div>
</fieldset>
<input
type=
"hidden"
name=
"id"
value=
"{tmpl_var name='id'}"
>
...
...
interface/web/sites/ajax_get_fastcgi_php_versions.php
0 → 100644
View file @
62b385fc
<?php
/*
Copyright (c) 2005, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require_once
(
'../../lib/config.inc.php'
);
require_once
(
'../../lib/app.inc.php'
);
//* Check permissions for module
$app
->
auth
->
check_module_permissions
(
'sites'
);
$server_id
=
intval
(
$_GET
[
"server_id"
]);
$client_group_id
=
intval
(
$_GET
[
"client_group_id"
]);
if
(
$_SESSION
[
"s"
][
"user"
][
"typ"
]
==
'admin'
or
$app
->
auth
->
has_clients
(
$_SESSION
[
's'
][
'user'
][
'userid'
]))
{
$app
->
uses
(
'ini_parser,getconf'
);
$fastcgi
=
$app
->
getconf
->
get_server_config
(
$server_id
,
'fastcgi'
);
$php_versions
=
explode
(
'\n'
,
$fastcgi
[
'fastcgi_additional_php_versions'
]);
$php_select
=
""
;
if
(
is_array
(
$php_versions
))
{
foreach
(
$php_versions
as
$php_version
)
{
$php_select
.
=
"#
$php_version
"
;
}
}
unset
(
$php_versions
);
}
echo
$php_select
;
?>
\ No newline at end of file
interface/web/sites/form/web_domain.tform.php
View file @
62b385fc
...
...
@@ -210,6 +210,17 @@ $form["tabs"]['domain'] = array (
'valuelimit'
=>
'client:web_php_options'
,
'value'
=>
array
(
'no'
=>
'disabled_txt'
,
'fast-cgi'
=>
'Fast-CGI'
,
'cgi'
=>
'CGI'
,
'mod'
=>
'Mod-PHP'
,
'suphp'
=>
'SuPHP'
)
),
'fastcgi_php_version'
=>
array
(
'datatype'
=>
'VARCHAR'
,
'formtype'
=>
'SELECT'
,
'default'
=>
''
,
/*'datasource' => array ( 'type' => 'SQL',
'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv4' AND {AUTHSQL} ORDER BY ip_address",
'keyfield'=> 'ip_address',
'valuefield'=> 'ip_address'
),*/
'value'
=>
''
),
'ruby'
=>
array
(
'datatype'
=>
'VARCHAR'
,
'formtype'
=>
'CHECKBOX'
,
...
...
interface/web/sites/lib/lang/de_web_domain.lng
View file @
62b385fc
...
...
@@ -89,4 +89,5 @@ $wb['pm_max_children_error_regex'] = 'PHP-FPM pm.max_children muß eine pos
$wb
[
'pm_start_servers_error_regex'
]
=
'PHP-FPM pm.start_servers muß eine positive ganze Zahl sein.'
;
$wb
[
'pm_min_spare_servers_error_regex'
]
=
'PHP-FPM pm.min_spare_servers muß eine positive ganze Zahl sein.'
;
$wb
[
'pm_max_spare_servers_error_regex'
]
=
'PHP-FPM pm.max_spare_servers muß eine positive ganze Zahl sein.'
;
$wb
[
"fastcgi_php_version_txt"
]
=
'FastCGI-PHP-Version'
;
?>
interface/web/sites/lib/lang/en_web_domain.lng
View file @
62b385fc
...
...
@@ -89,4 +89,5 @@ $wb["pm_max_children_error_regex"] = 'PHP-FPM pm.max_children must be a positive
$wb
[
"pm_start_servers_error_regex"
]
=
'PHP-FPM pm.start_servers must be a positive integer value.'
;
$wb
[
"pm_min_spare_servers_error_regex"
]
=
'PHP-FPM pm.min_spare_servers must be a positive integer value.'
;
$wb
[
"pm_max_spare_servers_error_regex"
]
=
'PHP-FPM pm.max_spare_servers must be a positive integer value.'
;
$wb
[
"fastcgi_php_version_txt"
]
=
'FastCGI PHP Version'
;
?>
\ No newline at end of file
interface/web/sites/templates/web_domain_edit.htm
View file @
62b385fc
...
...
@@ -121,6 +121,12 @@
<select
name=
"php"
id=
"php"
class=
"selectInput formLengthHalf"
>
{tmpl_var name='php'}
</select>
</div>
<div
class=
"ctrlHolder fastcgi_php_version"
>
<label
for=
"fastcgi_php_version"
>
{tmpl_var name='fastcgi_php_version_txt'}
</label>
<select
name=
"fastcgi_php_version"
id=
"fastcgi_php_version"
class=
"selectInput formLengthHalf"
>
{tmpl_var name='fastcgi_php_version'}
</select>
</div>
<div
class=
"ctrlHolder"
>
<p
class=
"label"
>
{tmpl_var name='active_txt'}
</p>
...
...
@@ -151,6 +157,7 @@
serverId
=
$
(
this
).
val
();
adjustForm
();
reloadWebIP
();
reloadFastcgiPHPVersions
();
});
}
adjustForm
();
...
...
@@ -160,6 +167,14 @@
reloadWebIP
();
});
jQuery
(
'
#php
'
).
change
(
function
(){
if
(
jQuery
(
this
).
val
()
==
'
fast-cgi
'
){
jQuery
(
'
.fastcgi_php_version
'
).
show
();
}
else
{
jQuery
(
'
.fastcgi_php_version
'
).
hide
();
}
});
function
adjustForm
(){
jQuery
.
getJSON
(
'
sites/ajax_get_json.php
'
+
'
?
'
+
Math
.
round
(
new
Date
().
getTime
()),
{
server_id
:
serverId
,
type
:
"
getservertype
"
},
function
(
data
)
{
if
(
data
.
servertype
==
"
nginx
"
){
...
...
@@ -184,5 +199,9 @@
loadOptionInto
(
'
ip_address
'
,
'
sites/ajax_get_ip.php?ip_type=IPv4&server_id=
'
+
serverId
+
'
&client_group_id=
'
+
clientGroupId
);
loadOptionInto
(
'
ipv6_address
'
,
'
sites/ajax_get_ip.php?ip_type=IPv6&server_id=
'
+
serverId
+
'
&client_group_id=
'
+
clientGroupId
);
}
function
reloadFastcgiPHPVersions
()
{
loadOptionInto
(
'
fastcgi_php_version
'
,
'
sites/ajax_get_fastcgi_php_versions.php?server_id=
'
+
serverId
+
'
&client_group_id=
'
+
clientGroupId
);
}
</script>
interface/web/sites/web_domain_edit.php
View file @
62b385fc
...
...
@@ -45,7 +45,7 @@ require_once('../../lib/app.inc.php');
$app
->
auth
->
check_module_permissions
(
'sites'
);
// Loading classes
$app
->
uses
(
'tpl,tform,tform_actions'
);
$app
->
uses
(
'tpl,tform,tform_actions
,ini_parser,getconf
'
);
$app
->
load
(
'tform_actions'
);
class
page_action
extends
tform_actions
{
...
...
@@ -128,6 +128,19 @@ class page_action extends tform_actions {
$app
->
tpl
->
setVar
(
"ipv6_address"
,
$ip_select
);
unset
(
$tmp
);
unset
(
$ips
);
//PHP Version Selection (FastCGI)
$fastcgi
=
$app
->
getconf
->
get_server_config
(
$client
[
'default_webserver'
],
'fastcgi'
);
$php_versions
=
explode
(
'\n'
,
$fastcgi
[
'fastcgi_additional_php_versions'
]);
$php_select
=
"<option value=''>Default</option>"
;
if
(
is_array
(
$php_versions
))
{
foreach
(
$php_versions
as
$php_version
)
{
$selected
=
(
$php_version
==
$this
->
dataRecord
[
"fastcgi_php_version"
])
?
'SELECTED'
:
''
;
$php_select
.
=
"<option value='
$php_version
'
$selected
>
$php_version
</option>
\r\n
"
;
}
}
$app
->
tpl
->
setVar
(
"fastcgi_php_version"
,
$php_select
);
unset
(
$php_versions
);
//* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
}
elseif
(
$_SESSION
[
"s"
][
"user"
][
"typ"
]
!=
'admin'
&&
$app
->
auth
->
has_clients
(
$_SESSION
[
's'
][
'user'
][
'userid'
]))
{
...
...
@@ -184,6 +197,19 @@ class page_action extends tform_actions {
$app
->
tpl
->
setVar
(
"ipv6_address"
,
$ip_select
);
unset
(
$tmp
);
unset
(
$ips
);
//PHP Version Selection (FastCGI)
$fastcgi
=
$app
->
getconf
->
get_server_config
(
$client
[
'default_webserver'
],
'fastcgi'
);
$php_versions
=
explode
(
'\n'
,
$fastcgi
[
'fastcgi_additional_php_versions'
]);
$php_select
=
"<option value=''>Default</option>"
;
if
(
is_array
(
$php_versions
))
{
foreach
(
$php_versions
as
$php_version
)
{
$selected
=
(
$php_version
==
$this
->
dataRecord
[
"fastcgi_php_version"
])
?
'SELECTED'
:
''
;
$php_select
.
=
"<option value='
$php_version
'
$selected
>
$php_version
</option>
\r\n
"
;
}
}
$app
->
tpl
->
setVar
(
"fastcgi_php_version"
,
$php_select
);
unset
(
$php_versions
);
//* Admin: If the logged in user is admin
}
else
{
...
...
@@ -226,6 +252,19 @@ class page_action extends tform_actions {
$app
->
tpl
->
setVar
(
"ipv6_address"
,
$ip_select
);
unset
(
$tmp
);
unset
(
$ips
);
//PHP Version Selection (FastCGI)
$fastcgi
=
$app
->
getconf
->
get_server_config
(
$server_id
,
'fastcgi'
);
$php_versions
=
explode
(
'\n'
,
$fastcgi
[
'fastcgi_additional_php_versions'
]);
$php_select
=
"<option value=''>Default</option>"
;
if
(
is_array
(
$php_versions
))
{
foreach
(
$php_versions
as
$php_version
)
{
$selected
=
(
$php_version
==
$this
->
dataRecord
[
"fastcgi_php_version"
])
?
'SELECTED'
:
''
;
$php_select
.
=
"<option value='
$php_version
'
$selected
>
$php_version
</option>
\r\n
"
;
}
}
$app
->
tpl
->
setVar
(
"fastcgi_php_version"
,
$php_select
);
unset
(
$php_versions
);
// Fill the client select field
$sql
=
"SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name"
;
...
...
server/plugins-available/apache2_plugin.inc.php
View file @
62b385fc
...
...
@@ -909,15 +909,32 @@ class apache2_plugin {
$fcgi_tpl
=
new
tpl
();
$fcgi_tpl
->
newTemplate
(
'php-fcgi-starter.master'
);
// Support for multiple PHP versions (FastCGI)
if
(
trim
(
$data
[
'new'
][
'fastcgi_php_version'
])
!=
''
){
$default_fastcgi_php
=
false
;
list
(
$custom_fastcgi_php_name
,
$custom_fastcgi_php_executable
,
$custom_fastcgi_php_ini_dir
)
=
explode
(
';'
,
trim
(
$data
[
'new'
][
'fastcgi_php_version'
]));
if
(
substr
(
$custom_fastcgi_php_ini_dir
,
-
1
)
!=
'/'
)
$custom_fastcgi_php_ini_dir
.
=
'/'
;
}
else
{
$default_fastcgi_php
=
true
;
}
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'
]));
if
(
$default_fastcgi_php
){
$fcgi_tpl
->
setVar
(
'php_ini_path'
,
escapeshellcmd
(
$fastcgi_config
[
'fastcgi_phpini_path'
]));
}
else
{
$fcgi_tpl
->
setVar
(
'php_ini_path'
,
escapeshellcmd
(
$custom_fastcgi_php_ini_dir
));
}
}
$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'
]));
$fcgi_tpl
->
setVar
(
'php_fcgi_bin'
,
escapeshellcmd
(
$fastcgi_config
[
'fastcgi_bin'
]));
if
(
$default_fastcgi_php
){
$fcgi_tpl
->
setVar
(
'php_fcgi_bin'
,
escapeshellcmd
(
$fastcgi_config
[
'fastcgi_bin'
]));
}
else
{
$fcgi_tpl
->
setVar
(
'php_fcgi_bin'
,
escapeshellcmd
(
$custom_fastcgi_php_executable
));
}
$fcgi_tpl
->
setVar
(
'security_level'
,
intval
(
$web_config
[
'security_level'
]));
$php_open_basedir
=
(
$data
[
'new'
][
'php_open_basedir'
]
==
''
)
?
$data
[
'new'
][
'document_root'
]
:
$data
[
'new'
][
'php_open_basedir'
];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment