Debian上PHP运行慢可按以下步骤优化:
sudo apt install php-opcache
# 编辑php.ini,设置:
opcache.enable=1
opcache.memory_consumption=128M
opcache.max_accelerated_files=4000
php.ini参数,如增大memory_limit、合理设置max_execution_time。top、htop等工具监控资源,调整内核参数(如vm.swappiness)。操作前建议备份配置文件,并在测试环境验证效果。