软件版本和系统环境参考这三篇为前提
apache:https://blog.51cto.com/popli3/2357295
PHP:https://blog.51cto.com/popli3/2358720
mysql:https://blog.51cto.com/popli3/2357211
在以上环境完成后,编辑vi /usr/local/apache2.4/conf/httpd.conf 搜索Require all denied,把denied改成granted
ServerName www.example.com:80
#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride none
Require all granted
</Directory>
2. 搜索AddType,添加一行php的规则
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-httpd-php .php
AddType application/x-gzip .gz .tgz
3. 搜索index.html 添加php解析
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
4. 重启apache
[root@minion-1 ~]# /usr/local/apache2.4/bin/apachectl graceful
5. 写个test.php页面,用http://ip/test.php访问是否有返回
[root@minion-1 ~]# vi /usr/local/apache2.4/htdocs/test.php
<?php
phpinfo();