diff --git a/plugins/php/conf/php-fpm.conf b/plugins/php/conf/php-fpm.conf index 8e8566306..520a62edf 100644 --- a/plugins/php/conf/php-fpm.conf +++ b/plugins/php/conf/php-fpm.conf @@ -1,5 +1,5 @@ [global] -include=MD:/bin/php/php71/etc/php-fpm.d/*.conf -php_value[auto_prepend_file]=MD:/htdocs/md_start.php -php_value[auto_append_file]=MD:/htdocs/md_end.php \ No newline at end of file +include={$SERVER_PATH}/php/{$PHP_VERSION}/etc/php-fpm.d/*.conf +;php_value[auto_prepend_file]={$SERVER_PATH}/md_start.php +;php_value[auto_append_file]={$SERVER_PATH}/md_end.php \ No newline at end of file diff --git a/plugins/php/conf/www.conf b/plugins/php/conf/www.conf index 1f66f30ce..f9e4a2e0e 100644 --- a/plugins/php/conf/www.conf +++ b/plugins/php/conf/www.conf @@ -1,7 +1,7 @@ [www] -user = nobody -group = nobody -listen = 127.0.0.1:9000 +user = www +group = www +listen = /tmp/php{$PHP_VERSION}.sock pm = dynamic pm.max_children = 5 pm.start_servers = 2 diff --git a/plugins/php/index.py b/plugins/php/index.py index 75515a084..586322fb4 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -64,11 +64,28 @@ def status(version): def phpFpmReplace(version): service_path = public.getServerDir() - php_fpm = getPluginDir() + '/conf/php-fpm.conf' + + tpl_php_fpm = getPluginDir() + '/conf/php-fpm.conf' + service_php_fpm = getServerDir() + '/' + version + '/etc/php-fpm.conf' + content = public.readFile(tpl_php_fpm) + content = content.replace('{$SERVER_PATH}', service_path) + content = content.replace('{$PHP_VERSION}', version) + + public.writeFile(service_php_fpm, content) def phpFpmWwwReplace(version): - php_fpm_www = getPluginDir() + '/conf/www.conf' + service_path = public.getServerDir() + + tpl_php_fpmwww = getPluginDir() + '/conf/www.conf' + service_php_fpm_dir = getServerDir() + '/' + version + '/etc/php-fpm.d/' + service_php_fpmwww = service_php_fpm_dir + '/www.conf' + if not os.path.exists(service_php_fpm_dir): + os.mkdir(service_php_fpm_dir) + + content = public.readFile(tpl_php_fpmwww) + content = content.replace('{$PHP_VERSION}', version) + public.writeFile(service_php_fpmwww, content) def initDreplace(version): @@ -87,14 +104,15 @@ def initDreplace(version): public.writeFile(file_bin, content) public.execShell('chmod +x ' + file_bin) + phpFpmWwwReplace(version) phpFpmReplace(version) + return file_bin def phpOp(version, method): file = initDreplace(version) data = public.execShell(file + ' ' + method) - print data if data[1] == '': return 'ok' return 'fail'