在 Debian 上“重启 LAMP”通常是指重启 Apache + MySQL/MariaDB + PHP(PHP 一般不需要单独重启,除非改了 PHP 配置)。下面按常见情况给你说明。
sudo systemctl restart apache2
查看状态:
sudo systemctl status apache2
先确认你用的是哪个:
sudo systemctl status mysql
# 或
sudo systemctl status mariadb
sudo systemctl restart mysql
sudo systemctl restart mariadb
sudo systemctl restart apache2
sudo systemctl restart mysql
# 或
sudo systemctl restart mariadb
PHP 一般随 Apache 一起生效(mod_php),重启 Apache 即可。
如果是 PHP-FPM:
sudo systemctl restart php-fpm
# 或(版本相关)
sudo systemctl restart php8.2-fpm
sudo systemctl enable apache2
sudo systemctl enable mysql
# 或
sudo systemctl enable mariadb
如果你愿意,可以告诉我:
我可以给你更精确的一条命令。