【一、安装Apache】
yum install httpd httpd-devel
【二、安装PHP及插件】
yum install php php-mysql php-common php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc
【三:启动Apache】
systemctal start httpd
设置Apache的httpd服务开机启动:chkconfig httpd on
设置MySQL服务开机启动:chkconfig mysqld on
Apache安装完成后,根目录的默认路径为/var/www/html/
,此时可在些目录建立PHP文件 如:index.php,输入代码:
<?php
phpinfo();
?>
此时可以去浏览器测试 ,(默认关闭防火墙)
【四、PHPmyadmin安装配置】
1、先安装epel,不然安装pgpmyadmin时会出现找不到包。
yum install epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
2、安装,
yum install phpmyadmin
3、修改配置文件
vi /etc/httpd/conf.d/phpMyAdmin.conf
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
Apache 2.4
# Require ip 127.0.0.1 #注释掉
# Require ip ::1 #注释掉
Require all granted #新添加
Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
<Directory /usr/share/phpMyAdmin/setup/>
Apache 2.4
#Require ip 127.0.0.1 #注释掉
#Require ip ::1 #注释掉
Require all granted #新添加
Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
4、重启httpd使改动生效。
systemctl restart httpd
5、测试
ip/phpmyadmin
[参考文档]
https://blog.51cto.com/sonice/2412188
https://www.ruixunidc.net/a/guanyuruixun/wenzhangzixun/wenzhangzhongxin/2019/0708/602.html