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
ISPConfig
ISPConfig 3
Commits
1c6da350
Commit
1c6da350
authored
Apr 30, 2014
by
Marius Cramer
Browse files
Implemented: FS#3266 - HHVM PHP mode support (some improvements, nginx support)
parent
c5963289
Changes
8
Hide whitespace changes
Inline
Side-by-side
interface/web/client/form/client.tform.php
View file @
1c6da350
...
...
@@ -823,7 +823,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'
)
'value'
=>
array
(
'no'
=>
'Disabled'
,
'fast-cgi'
=>
'Fast-CGI'
,
'cgi'
=>
'CGI'
,
'mod'
=>
'Mod-PHP'
,
'suphp'
=>
'SuPHP'
,
'php-fpm'
=>
'PHP-FPM'
,
'hhvm'
=>
'HHVM'
)
),
'limit_cgi'
=>
array
(
'datatype'
=>
'VARCHAR'
,
...
...
interface/web/client/form/client_template.tform.php
View file @
1c6da350
...
...
@@ -345,7 +345,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'
)
'value'
=>
array
(
'no'
=>
'Disabled'
,
'fast-cgi'
=>
'Fast-CGI'
,
'cgi'
=>
'CGI'
,
'mod'
=>
'Mod-PHP'
,
'suphp'
=>
'SuPHP'
,
'php-fpm'
=>
'PHP-FPM'
,
'hhvm'
=>
'HHVM'
)
),
'limit_cgi'
=>
array
(
'datatype'
=>
'VARCHAR'
,
...
...
interface/web/client/form/reseller.tform.php
View file @
1c6da350
...
...
@@ -818,7 +818,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'
)
'value'
=>
array
(
'no'
=>
'Disabled'
,
'fast-cgi'
=>
'Fast-CGI'
,
'cgi'
=>
'CGI'
,
'mod'
=>
'Mod-PHP'
,
'suphp'
=>
'SuPHP'
,
'php-fpm'
=>
'PHP-FPM'
,
'hhvm'
=>
'HHVM'
)
),
'limit_cgi'
=>
array
(
'datatype'
=>
'VARCHAR'
,
...
...
server/conf/hhvm_starter.master
View file @
1c6da350
...
...
@@ -16,12 +16,22 @@ NAME=hhvm
do_start
()
{
{
START
}
if
[
!
-d
/var/run/hhvm
]
;
then
mkdir
-p
-m0777
/var/run/hhvm
else
chmod
777 /var/run/hhvm
fi
umask
017
sudo
-u
{
SYSTEM_USER
}
touch
/var/run/hhvm/hhvm_
{
SYSTEM_USER
}
.pid
/usr/bin/hhvm
--mode
daemon
-vServer
.Type
=
fastcgi
--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
-vPidFile
=
/var/run/hhvm/hhvm_
{
SYSTEM_USER
}
.pid &
echo
$!
>
/var/run/hhvm/hhvm_
{
SYSTEM_USER
}
.pid
}
do_stop
()
{
{
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
...
...
server/conf/nginx_vhost.conf.master
View file @
1c6da350
...
...
@@ -152,9 +152,22 @@ 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;
fastcgi_intercept_errors on;
}
</tmpl_else>
location @php {
deny all;
}
</tmpl_if>
</tmpl_if>
<tmpl_if name='cgi' op='==' value='y'>
...
...
server/conf/vhost.conf.master
View file @
1c6da350
...
...
@@ -337,7 +337,7 @@
</FilesMatch>
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi {tmpl_var name='document_root'}/cgi-bin/php5-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'}
FastCgiExternalServer {tmpl_var name='document_root'}/cgi-bin/php5-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'} -idle-timeout 300 -socket /
tmp
/hhvm.<tmpl_var name='system_user'>.sock -pass-header Authorization
FastCgiExternalServer {tmpl_var name='document_root'}/cgi-bin/php5-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
</IfModule>
</tmpl_if>
...
...
server/plugins-available/apache2_plugin.inc.php
View file @
1c6da350
...
...
@@ -2738,23 +2738,9 @@ class apache2_plugin {
}
else
{
$content
=
file_get_contents
(
$conf
[
'rootpath'
]
.
'/conf/hhvm_starter.master'
);
}
$start_content
=
''
;
$stop_content
=
''
;
if
(
$data
[
'new'
][
'php'
]
==
'hhvm'
&&
$data
[
'old'
][
'php'
]
!=
'hhvm'
)
{
$start_content
.
=
'if [ ! -d /var/run/hhvm ]; then
mkdir -p -m0777 /var/run/hhvm
else
chmod 777 /var/run/hhvm
fi
umask 017
sudo -u '
.
$data
[
'new'
][
'system_user'
]
.
' touch /var/run/hhvm/hhvm_'
.
$data
[
'new'
][
'system_user'
]
.
'.pid
/usr/bin/hhvm --mode daemon -vServer.Type=fastcgi --user '
.
$data
[
'new'
][
'system_user'
]
.
' -vServer.FileSocket=/tmp/hhvm.'
.
$data
[
'new'
][
'system_user'
]
.
'.sock -vLog.Level=Warning -vLog.UseLogFile=false -vRepo.Central.Path=/tmp/hhvm.'
.
$data
[
'new'
][
'system_user'
]
.
'.hhbc -vPidFile=/var/run/hhvm/hhvm_'
.
$data
[
'new'
][
'system_user'
]
.
'.pid & echo $! > /var/run/hhvm/hhvm_'
.
$data
[
'new'
][
'system_user'
]
.
'.pid'
;
$stop_content
.
=
'if [[ -e "/var/run/hhvm/hhvm_'
.
$data
[
'new'
][
'system_user'
]
.
'.pid" ]] ; then kill -SIGTERM `cat /var/run/hhvm/hhvm_'
.
$data
[
'new'
][
'system_user'
]
.
'.pid` >/dev/null 2>&1 ; fi
rm -f /tmp/hhvm.'
.
$data
[
'new'
][
'system_user'
]
.
'.sock /tmp/hhvm.'
.
$data
[
'new'
][
'system_user'
]
.
'.hhbc /var/run/hhvm/hhvm_'
.
$data
[
'new'
][
'system_user'
]
.
'.pid'
;
$content
=
str_replace
(
array
(
'{START}'
,
'{STOP}'
,
'{SYSTEM_USER}'
),
array
(
$start_content
,
$stop_content
,
$data
[
'new'
][
'system_user'
]),
$content
);
$content
=
str_replace
(
'{SYSTEM_USER}'
,
$data
[
'new'
][
'system_user'
],
$content
);
file_put_contents
(
'/etc/init.d/hhvm_'
.
$data
[
'new'
][
'system_user'
],
$content
);
exec
(
'chmod +x /etc/init.d/hhvm_'
.
$data
[
'new'
][
'system_user'
]
.
' >/dev/null 2>&1'
);
exec
(
'/usr/sbin/update-rc.d hhvm_'
.
$data
[
'new'
][
'system_user'
]
.
' defaults >/dev/null 2>&1'
);
...
...
server/plugins-available/nginx_plugin.inc.php
View file @
1c6da350
...
...
@@ -1644,6 +1644,7 @@ class nginx_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 nginx starts with the new configuration file
...
...
@@ -1954,6 +1955,8 @@ class nginx_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
...
...
@@ -2301,6 +2304,28 @@ class nginx_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
(
$data
[
'new'
][
'php'
]
==
'hhvm'
&&
$data
[
'old'
][
'php'
]
!=
'hhvm'
)
{
$content
=
str_replace
(
'{SYSTEM_USER}'
,
$data
[
'new'
][
'system_user'
],
$content
);
file_put_contents
(
'/etc/init.d/hhvm_'
.
$data
[
'new'
][
'system_user'
],
$content
);
exec
(
'chmod +x /etc/init.d/hhvm_'
.
$data
[
'new'
][
'system_user'
]
.
' >/dev/null 2>&1'
);
exec
(
'/usr/sbin/update-rc.d hhvm_'
.
$data
[
'new'
][
'system_user'
]
.
' defaults >/dev/null 2>&1'
);
exec
(
'/etc/init.d/hhvm_'
.
$data
[
'new'
][
'system_user'
]
.
' start >/dev/null 2>&1'
);
}
elseif
(
$data
[
'new'
][
'php'
]
!=
'hhvm'
&&
$data
[
'old'
][
'php'
]
==
'hhvm'
)
{
exec
(
'/etc/init.d/hhvm_'
.
$data
[
'old'
][
'system_user'
]
.
' stop >/dev/null 2>&1'
);
exec
(
'/usr/sbin/update-rc.d hhvm_'
.
$data
[
'old'
][
'system_user'
]
.
' remove >/dev/null 2>&1'
);
unlink
(
'/etc/init.d/hhvm_'
.
$data
[
'old'
][
'system_user'
]
.
' >/dev/null 2>&1'
);
}
}
//* Update the PHP-FPM pool configuration file
private
function
php_fpm_pool_update
(
$data
,
$web_config
,
$pool_dir
,
$pool_name
,
$socket_dir
)
{
global
$app
,
$conf
;
...
...
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