diff --git a/app/http/controllers/plugins/php_controller.go b/app/http/controllers/plugins/php_controller.go index ab249ca2..98e5e395 100644 --- a/app/http/controllers/plugins/php_controller.go +++ b/app/http/controllers/plugins/php_controller.go @@ -76,6 +76,24 @@ func (r *PHPController) SaveConfig(ctx http.Context) http.Response { return controllers.Success(ctx, nil) } +func (r *PHPController) GetFPMConfig(ctx http.Context) http.Response { + config, err := r.service.GetFPMConfig() + if err != nil { + return controllers.Error(ctx, http.StatusInternalServerError, err.Error()) + } + + return controllers.Success(ctx, config) +} + +func (r *PHPController) SaveFPMConfig(ctx http.Context) http.Response { + config := ctx.Request().Input("config") + if err := r.service.SaveFPMConfig(config); err != nil { + return controllers.Error(ctx, http.StatusInternalServerError, err.Error()) + } + + return controllers.Success(ctx, nil) +} + func (r *PHPController) Load(ctx http.Context) http.Response { load, err := r.service.Load() if err != nil { diff --git a/routes/plugin.go b/routes/plugin.go index 20a1bd81..71268258 100644 --- a/routes/plugin.go +++ b/routes/plugin.go @@ -148,6 +148,8 @@ func Plugin() { route.Get("load", php74Controller.Load) route.Get("config", php74Controller.GetConfig) route.Post("config", php74Controller.SaveConfig) + route.Get("fpmConfig", php74Controller.GetFPMConfig) + route.Post("fpmConfig", php74Controller.SaveFPMConfig) route.Get("errorLog", php74Controller.ErrorLog) route.Get("slowLog", php74Controller.SlowLog) route.Post("clearErrorLog", php74Controller.ClearErrorLog) @@ -166,6 +168,8 @@ func Plugin() { route.Get("load", php80Controller.Load) route.Get("config", php80Controller.GetConfig) route.Post("config", php80Controller.SaveConfig) + route.Get("fpmConfig", php80Controller.GetFPMConfig) + route.Post("fpmConfig", php80Controller.SaveFPMConfig) route.Get("errorLog", php80Controller.ErrorLog) route.Get("slowLog", php80Controller.SlowLog) route.Post("clearErrorLog", php80Controller.ClearErrorLog) @@ -184,6 +188,8 @@ func Plugin() { route.Get("load", php81Controller.Load) route.Get("config", php81Controller.GetConfig) route.Post("config", php81Controller.SaveConfig) + route.Get("fpmConfig", php81Controller.GetFPMConfig) + route.Post("fpmConfig", php81Controller.SaveFPMConfig) route.Get("errorLog", php81Controller.ErrorLog) route.Get("slowLog", php81Controller.SlowLog) route.Post("clearErrorLog", php81Controller.ClearErrorLog) @@ -202,6 +208,8 @@ func Plugin() { route.Get("load", php82Controller.Load) route.Get("config", php82Controller.GetConfig) route.Post("config", php82Controller.SaveConfig) + route.Get("fpmConfig", php82Controller.GetFPMConfig) + route.Post("fpmConfig", php82Controller.SaveFPMConfig) route.Get("errorLog", php82Controller.ErrorLog) route.Get("slowLog", php82Controller.SlowLog) route.Post("clearErrorLog", php82Controller.ClearErrorLog) @@ -220,6 +228,8 @@ func Plugin() { route.Get("load", php83Controller.Load) route.Get("config", php83Controller.GetConfig) route.Post("config", php83Controller.SaveConfig) + route.Get("fpmConfig", php83Controller.GetFPMConfig) + route.Post("fpmConfig", php83Controller.SaveFPMConfig) route.Get("errorLog", php83Controller.ErrorLog) route.Get("slowLog", php83Controller.SlowLog) route.Post("clearErrorLog", php83Controller.ClearErrorLog) diff --git a/scripts/php/install.sh b/scripts/php/install.sh index 73614505..d3bbb5f4 100644 --- a/scripts/php/install.sh +++ b/scripts/php/install.sh @@ -122,9 +122,9 @@ fi # 配置 cd src if [ "${phpVersion}" == "81" ] || [ "${phpVersion}" == "82" ] || [ "${phpVersion}" == "83" ]; then - ./configure --prefix=${phpPath} --with-config-file-path=${phpPath}/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-freetype --with-jpeg --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmop --with-curl --enable-mbregex --enable-mbstring --enable-pcntl --enable-ftp --enable-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --enable-soap --with-gettext --enable-fileinfo --enable-opcache --with-sodium --with-webp --with-avif + ./configure --prefix=${phpPath} --with-config-file-path=${phpPath}/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-freetype --with-jpeg --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmop --with-curl --enable-mbregex --enable-mbstring --enable-pcntl --enable-ftp --enable-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --enable-soap --disable-fileinfo --enable-opcache --with-sodium --with-webp --with-avif else - ./configure --prefix=${phpPath} --with-config-file-path=${phpPath}/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-freetype --with-jpeg --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-pcntl --enable-ftp --enable-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --with-gettext --enable-fileinfo --enable-opcache --with-sodium --with-webp + ./configure --prefix=${phpPath} --with-config-file-path=${phpPath}/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-freetype --with-jpeg --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-pcntl --enable-ftp --enable-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --disable-fileinfo --enable-opcache --with-sodium --with-webp fi # 编译安装