指导文件
:PHP: Apache 2.x on Unix systems - Manual
下载路径
![](https://img-blog.csdnimg.cn/direct/e146aee85d3f45f3b1f363e40aa12319.png)
configure: error: APR not found.
解决方案:
APR(Apache Portable Runtime)库。APR是Apache HTTP服务器的可移植运行时环境,许多软件依赖APR来提供基础的功能和可移植性。
yum install apr apr-devel
放弃编译,通过yum 进行安装apache
sudo yum update
sudo yum install httpd
sudo systemctl start httpd
sudo systemctl enable httpd
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
配置php运行环境
安装php
yum install php
sudo yum install php-mysqlnd php-xml
![](https://img-blog.csdnimg.cn/direct/2cda681f76644ecc85f72002c3d078fa.png)
yum install php-fpm -y
systemctl start php-fpm
systemctl enable php-fpm
![](https://img-blog.csdnimg.cn/direct/b2904b88b9ef4e5a852664c1959d1bd8.png)
创建一个PHP文件以测试PHP是否正常工作:
<?php
phpinfo();
?>
![](https://img-blog.csdnimg.cn/direct/4bb1b0e2f6534201b5cd620e9bb1f0ab.png)
重启httpd 使php模块生效
sudo systemctl restart httpd
访问info.php
![](https://img-blog.csdnimg.cn/direct/35dffca979a94a0a866abd313c5f53a4.png)
yum install unzip -y
![](https://img-blog.csdnimg.cn/direct/bcde8cb830654284a2df2f49bf30dd7c.png)
No slotmem from mod_heartmonitor
![](https://img-blog.csdnimg.cn/direct/c61d276a297f49d29a41a313d6853253.png)
以上报错暂时跟程序运行无关
检测mysql端口通信
telnet 192.168.56.1 3306
修改mysql配置
![](https://img-blog.csdnimg.cn/direct/796103c7ebbe4979bb7fc5f6c482c809.png)
![](https://img-blog.csdnimg.cn/direct/d0dfcbd8c52846ac8d07d3b8c5ec8b27.png)
![](https://img-blog.csdnimg.cn/direct/b10a086331ff4970a31df8037d793cc3.png)
提升到上一个目录
![](https://img-blog.csdnimg.cn/direct/da6027b98f0d417e9abb1ab761cf1b96.png)
把数据库配置好访问成功
![](https://img-blog.csdnimg.cn/direct/e4fd5c05395d45958d90f7015410763b.png)