1.安装php
yum install "*php*" -y
2.配置httpd.conf支持php的解析
①UltraEdit定位到/etc/httpd/conf/httpd.conf
②找到“Include conf.modules.d/*.conf”,
在下面一行添加“LoadModule php5_module modules/libphp5.so”
③找到“AddType application/x-gzip .gz .tgz”在下面一行添加:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
④设置index.php为默认首页
修改
“DirectoryIndex test1.html index.html”为“DirectoryIndex index.php test1.html index.html”
⑤重启httpd服务
systemctl restart httpd
3.添加index.php网页
①cd /var/www/html
②touch index.php
③用UltraEdit编辑新建的index.php:
<?php
phpinfo();
?>
④浏览器内测试连接:http://192.168.31.120:8080/ ,显示php页面。