| | |
| | | * PHP-FPM |
| | | */ |
| | | // Support for multiple PHP versions |
| | | if($data['new']['php'] == 'php-fpm' || $data['new']['php'] == 'hhvm'){ |
| | | if($data['new']['php'] == 'php-fpm'){ |
| | | if(trim($data['new']['fastcgi_php_version']) != ''){ |
| | | $default_php_fpm = false; |
| | | list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); |
| | |
| | | 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'); |
| | | exec('/etc/init.d/hhvm_' . $data['new']['system_user'] . ' restart >/dev/null 2>&1'); |
| | | |
| | | $monit_content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $monit_content); |
| | | file_put_contents('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'], $monit_content); |
| | | exec('/etc/init.d/monit restart >/dev/null 2>&1'); |
| | | if(is_dir('/etc/monit/conf.d')){ |
| | | $monit_content = str_replace('{SYSTEM_USER}', $data['new']['system_user'], $monit_content); |
| | | file_put_contents('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'], $monit_content); |
| | | if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])) unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']); |
| | | exec('/etc/init.d/monit restart >/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'); |
| | |
| | | unlink('/etc/init.d/hhvm_' . $data['old']['system_user']); |
| | | if(is_file('/etc/hhvm/'.$data['old']['system_user'].'.ini')) unlink('/etc/hhvm/'.$data['old']['system_user'].'.ini'); |
| | | |
| | | if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])){ |
| | | unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']); |
| | | if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']) || is_file('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'])){ |
| | | if(is_file('/etc/monit/conf.d/hhvm_' . $data['new']['system_user'])){ |
| | | unlink('/etc/monit/conf.d/hhvm_' . $data['new']['system_user']); |
| | | } |
| | | if(is_file('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user'])){ |
| | | unlink('/etc/monit/conf.d/00-hhvm_' . $data['new']['system_user']); |
| | | } |
| | | exec('/etc/init.d/monit restart >/dev/null 2>&1'); |
| | | } |
| | | } |