diff --git a/plugins/php/index.py b/plugins/php/index.py index 586322fb4..c1c4e83f5 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -49,7 +49,7 @@ def getArgs(): def getConf(version): - path = getPluginDir() + "/init.d/php" + version + '.tpl' + path = getPluginDir() + "/init.d/php.tpl" return path @@ -62,14 +62,20 @@ def status(version): return 'start' -def phpFpmReplace(version): +def contentReplace(content, version): service_path = public.getServerDir() + content = content.replace('{$SERVER_PATH}', service_path) + content = content.replace('{$PHP_VERSION}', version) + return content + + +def phpFpmReplace(version): 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) + + content = contentReplace(content, version) public.writeFile(service_php_fpm, content) @@ -84,7 +90,7 @@ def phpFpmWwwReplace(version): os.mkdir(service_php_fpm_dir) content = public.readFile(tpl_php_fpmwww) - content = content.replace('{$PHP_VERSION}', version) + content = contentReplace(content, version) public.writeFile(service_php_fpmwww, content) @@ -99,7 +105,7 @@ def initDreplace(version): file_bin = initD_path + '/php' + version content = public.readFile(file_tpl) - content = content.replace('{$SERVER_PATH}', service_path) + content = contentReplace(content, version) public.writeFile(file_bin, content) public.execShell('chmod +x ' + file_bin) @@ -113,6 +119,7 @@ def initDreplace(version): def phpOp(version, method): file = initDreplace(version) data = public.execShell(file + ' ' + method) + print data if data[1] == '': return 'ok' return 'fail' diff --git a/plugins/php/init.d/php56.tpl b/plugins/php/init.d/php.tpl similarity index 98% rename from plugins/php/init.d/php56.tpl rename to plugins/php/init.d/php.tpl index 0d8806148..90b82b840 100644 --- a/plugins/php/init.d/php56.tpl +++ b/plugins/php/init.d/php.tpl @@ -10,7 +10,7 @@ # Description: starts the PHP FastCGI Process Manager daemon ### END INIT INFO -prefix={$SERVER_PATH}/php/56 +prefix={$SERVER_PATH}/php/{$PHP_VERSION} exec_prefix=${prefix} php_fpm_BIN=${exec_prefix}/sbin/php-fpm diff --git a/plugins/php/versions/72/install.sh b/plugins/php/versions/72/install.sh index ab1a83feb..b620eb3c7 100755 --- a/plugins/php/versions/72/install.sh +++ b/plugins/php/versions/72/install.sh @@ -54,6 +54,7 @@ cd $sourcePath/php/php-7.2.5 && ./configure \ Uninstall_php() { + rm -rf $serverPath/php/72 echo "卸载php-7.2.5 ..." > $install_tmp }