fix(install): 生成 APP_KEY 后重启 php,避免 LaravelS 先于密钥启动导致全新安装后服务不可用

This commit is contained in:
kuaifan 2026-10-22 11:19:18 +00:00
parent a2b3a0b30f
commit b93099a3df

7
cmd
View File

@ -897,8 +897,11 @@ handle_install() {
exit 1
fi
# 生成应用密钥
[[ -z "$(env_get APP_KEY)" ]] && exec_judge "container_exec php 'php artisan key:generate'" "$(msg '生成密钥失败')"
# 生成应用密钥(LaravelS 可能在 composer install 后已先行启动,需重启以加载新密钥)
if [[ -z "$(env_get APP_KEY)" ]]; then
exec_judge "container_exec php 'php artisan key:generate'" "$(msg '生成密钥失败')"
restart_php
fi
# 设置生产模式
switch_debug "false"