1、安装Apache
yum install httpd
安装完成之后,启动Apache
systemctl start httpd #启动Apache
systemctl restart httpd #重新启动Apache
systemctl stop httpd #关闭Apache
systemctl enable httpd #设置Apache自动启动
2、开启防火墙,或者开放80端口,或者开放httpd服务
firewall-cmd --add-service=http --permanent
或者自定义端口:
firewall-cmd --zone=public --add-port=81/tcp --permanent
生效之后,重启防火墙
systemctl restart firewalld
3、关闭SELINUX
vi /etc/selinux/config
\#SELINUX=enforcing #注释掉
\#SELINUXTYPE=targeted #注释掉
SELINUX=disabled #增加
4、使配置立即生效
setenforce 0 #使配置立即生效
5、安装mysql,不多讲
6、安装PHP以及PHP扩展所需要的包
yum install php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
7、安装完成后,重启Apache服务器
systemctl restart httpd.service
8、测试php安装是否成功
vi /var/www/html/index.php
输入如下:
<?php
phpinfo();
?>
保存退出,在浏览器上输入服务器IP,会出现内容,即PHP安装成功
9、开始安装phpadmin
首先安装epel-release
yum install epel-release
然后安装phpadmin
yum install phpmyadmin php-mcrypt
10、修改phpadmin配置文件
<Directory /usr/share/phpMyAdmin/> AddDefaultCharset UTF-8 <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> # Require ip 127.0.0.1 #注释掉 # Require ip ::1 #注释掉 Require all granted #新添加 </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1 </IfModule> </Directory> <Directory /usr/share/phpMyAdmin/setup/> <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> #Require ip 127.0.0.1 #注释掉 #Require ip ::1 #注释掉 Require all granted #新添加 </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1 </IfModule> </Directory>
大概就是注释掉所有的Require ip 127.0.0.1 和 Require ip ::1
并在注释的最后新增 Require all granted
11、重启Apaech
systemctl restart httpd