参考链接:
https://www.jianshu.com/p/bc14ff0ab1c7
测试环境:linux 7.6 64位 最小化安装包
CentOS-7-x86_64-Minimal-1810.iso
禁用firewalld和selinux
安装apache(httpd)
yum -y install httpd
yum -y install httpd-devel
yum -y install httpd-tools
systemctl enable httpd
systemctl start httpd
systemctl status httpd
安装mysql
看另一篇文章MySQL笔记(1)安装MySQL5.6
安装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 -y
systemctl restart httpd
测试php安装结果
vi /var/www/html/index.php (这个文件是默认没有的,直接执行命令进行创建)
输入如下内容
<?php
phpinfo();
?>
在浏览器输入服务器地址,查看是否可以看到
192.168.3.188
安装phpmyadmin
先安装epel
yum install epel-release -y
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum install phpmyadmin php-mcrypt -y
phpMyAdmin 的默认安装目录是 /usr/share/phpMyAdmin同时会在 Apache 的配置文件目录中自动创建虚拟主机配置文件 /etc/httpd/conf.d/phpMyAdmin.conf(区分大小写)。默认情况下,CentOS 7上的phpMyAdmin只允许从回环地址(127.0.0.1)访问。为了能远程连接,你需要改动它的配置。
vi /etc/httpd/conf.d/phpMyAdmin.conf
<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>
systemctl restart httpd
然后就可以通过浏览器访问http://服务器ip地址/phpmyadmin访问
192.168.3.188/phpmyadmin