根据运行方式选择重启命令
如果 PHP 是通过 PHP-FPM 运行,可以使用 systemctl restart php-fpm 或对应版本服务名,例如 systemctl restart php8.1-fpm。若 PHP 作为 Apache 模块运行,重启 Apache 即可生效,例如 systemctl restart httpd 或 systemctl restart apache2。若使用 Nginx 搭配 PHP-FPM,一般需要重启 PHP-FPM 服务,并在必要时重载 Nginx 配置。