fix: Resolve the php runtime start failed (#9369)

This commit is contained in:
CityFun 2025-07-02 12:23:35 +08:00 committed by GitHub
parent e10b19bcde
commit 94d37eb68a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 3 deletions

View file

@ -1018,6 +1018,12 @@ func HandleOldPHPRuntime() {
composeContent = strings.ReplaceAll(composeContent, "./extensions:${EXTENSION_DIR}", "./extensions:/usr/local/lib/php/extensions") composeContent = strings.ReplaceAll(composeContent, "./extensions:${EXTENSION_DIR}", "./extensions:/usr/local/lib/php/extensions")
_ = fileOp.WriteFile(composePtah, strings.NewReader(composeContent), constant.DirPerm) _ = fileOp.WriteFile(composePtah, strings.NewReader(composeContent), constant.DirPerm)
_ = fileOp.WriteFile(runtime.GetFPMPath(), bytes.NewReader(nginx_conf.GetWebsiteFile("php-fpm.conf")), constant.DirPerm) _ = fileOp.WriteFile(runtime.GetFPMPath(), bytes.NewReader(nginx_conf.GetWebsiteFile("php-fpm.conf")), constant.DirPerm)
supervisorConfigPath := path.Join(runtime.GetPath(), "supervisor", "supervisor.d", "php-fpm.ini")
supervisorConfigBytes, _ := fileOp.GetContent(supervisorConfigPath)
if !strings.Contains(string(supervisorConfigBytes), "nodaemonize") {
newConfigContent := strings.ReplaceAll(string(supervisorConfigBytes), "command=php-fpm", "command=php-fpm --nodaemonize")
_ = fileOp.WriteFile(supervisorConfigPath, bytes.NewReader([]byte(newConfigContent)), constant.DirPerm)
}
go func() { go func() {
_ = restartRuntime(&runtime) _ = restartRuntime(&runtime)
}() }()

View file

@ -1136,7 +1136,6 @@ func saveCertificateFile(websiteSSL *model.WebsiteSSL, logger *log.Logger) {
func GetSystemSSL() (bool, uint) { func GetSystemSSL() (bool, uint) {
sslSetting, err := settingRepo.Get(settingRepo.WithByKey("SSL")) sslSetting, err := settingRepo.Get(settingRepo.WithByKey("SSL"))
if err != nil { if err != nil {
global.LOG.Errorf("load service ssl from setting failed, err: %v", err)
return false, 0 return false, 0
} }
if sslSetting.Value == "enable" { if sslSetting.Value == "enable" {

View file

@ -4,7 +4,7 @@ log_level = notice
[www] [www]
user = www-data user = www-data
group = www-data group = www-data
listen = 127.0.0.1:9000 listen = 0.0.0.0:9000
pm = dynamic pm = dynamic
pm.max_children = 10 pm.max_children = 10
pm.start_servers = 2 pm.start_servers = 2

View file

@ -330,7 +330,7 @@ var AddSnapshotRule = &gormigrate.Migration{
}, },
} }
var UpdatePHPRuntime = &gormigrate.Migration{ var UpdatePHPRuntime = &gormigrate.Migration{
ID: "20250624-update-php-runtime", ID: "20250702-update-php-runtime",
Migrate: func(tx *gorm.DB) error { Migrate: func(tx *gorm.DB) error {
service.HandleOldPHPRuntime() service.HandleOldPHPRuntime()
return nil return nil