以下是CentOS上LAMP故障的排查步骤:
查看日志
/var/log/httpd/error_log/var/log/mysqld.logjournalctl -xe检查服务状态
systemctl status httpdsystemctl status mysqldsystemctl status php-fpm验证配置文件
apachectl configtest/etc/my.cnf,检查socket路径等排查端口与防火墙
netstat -tuln | grep 80(HTTP)/3306(MySQL)firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
处理权限与依赖
chown -R apache:apache /var/www/htmlyum install httpd-devel php-mysql等调整SELinux(若启用)
setenforce 0/etc/selinux/config,设置SELINUX=disabled测试基础功能
/var/www/html/info.php,内容<?php phpinfo(); ?>,通过浏览器访问验证PHP是否正常。若问题仍未解决,可根据日志中的具体错误信息进一步排查,或参考官方文档和社区资源。