1、源码安装
[[email protected]~]# yum install -y gcc gcc-c++ httpd php-xml php-pear php-mbstring php-cliphp-odbc php-pecl php-pdo php-gd php-xmlrpc php-devel php-mysql php-commonphp-process php-ldap php-bcmath rrdtool-php php-soap vim-X11 vim-commonvim-enhanced vim-filesystem vim-minimal
2、配置防火墙
[[email protected] ~]# yum install iptables-services
[[email protected] ~]# systemctl stop firewalld.service #停止firewall
[[email protected] ~]# systemctl disable firewalld.service#禁止firewall开机启动
3、修改APACHE配置文件
[[email protected] ~]# vim /etc/httpd/conf/httpd.conf
<IfModuledir_module>
DirectoryIndex index.php index.html
</IfModule>
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddTypeapplication/x-httpd-php .php
4、启动APACHE服务
[[email protected] ~]# systemctl start httpd.service
[[email protected] ~]# ps -ef | grep httpd
root 16122 1 1 10:18 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 16124 16122 0 10:18 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 16125 16122 0 10:18 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 16126 16122 0 10:18 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 16127 16122 0 10:18 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 16128 16122 0 10:18 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
5、编写PHP测试页
[[email protected] ~]# vi /var/www/html/index.php
<?php
phpinfo();
?>
:wq! #保存退出
在客户端浏览器输入服务器IP地址,可以看到如下图所示相关的配置信息!
http://ip地址/index.php