在 Linux + Laravel 环境下,“重启服务”通常要看你用的是哪种运行方式。下面按常见情况说明:
# 先结束旧进程
pkill -f "artisan serve"
# 重新启动
php artisan serve
或指定端口:
php artisan serve --host=0.0.0.0 --port=8000
# 查看 PHP 版本
php -v
# 例如 PHP 8.1
sudo systemctl restart php8.1-fpm
sudo systemctl restart nginx
php artisan config:clear
php artisan cache:clear
php artisan route:clear
php artisan view:clear
sudo systemctl restart apache2
如果你是跑 队列、WebSocket、定时任务:
sudo supervisorctl restart all
# 或单个
sudo supervisorctl restart laravel-worker
php artisan octane:stop
php artisan octane:start
docker-compose restart
# 或
docker-compose restart php nginx
.env → 必须:php artisan config:clear
tail -f storage/logs/laravel.log
如果你能告诉我:
我可以给你更精确的重启命令。