首页 > 代码库 > Centos 7 Apache解析PHP
Centos 7 Apache解析PHP
1、源码安装
[root@localhost~]# 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、配置防火墙
[root@localhost ~]# yum install iptables-services
[root@localhost ~]# systemctl stop firewalld.service #停止firewall
[root@localhost ~]# systemctl disable firewalld.service#禁止firewall开机启动
3、修改APACHE配置文件
[root@localhost ~]# 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服务
[root@localhost ~]# systemctl start httpd.service
[root@localhost ~]# 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测试页
[root@localhost ~]# vi /var/www/html/index.php
<?php
phpinfo();
?>
:wq! #保存退出
在客户端浏览器输入服务器IP地址,可以看到如下图所示相关的配置信息!
http://ip地址/index.php
本文出自 “开源净土” 博客,请务必保留此出处http://linuxunixcto.blog.51cto.com/7042759/1564613
Centos 7 Apache解析PHP