在CentOS 7上为PHP 7安装PHPMYADMIN
时间:2020-07-27 12:59:01 来源:igfitidea点击:
重要提示:EPEL存储库为PHP 5提供PHPMYADMIN包,但它与PHP 7不兼容。
对于PHP 7,我们需要手动下载并设置PHPMyAdmin Web界面。
为CentOS 7下载PHPMYADMIN
我们可以从以下URL https://www.phpmyadmin.net/downloads/获取下载链接到最新版本的phpmyadmin。
首先,以root身份登录并更改为/usr/share目录:
cd /usr/share
下载phpmyadmin包:
curl -O https://files.phpmyadmin.net/phpMyAdmin/4.7.5/phpMyAdmin-4.7.5-all-languages.tar.gz
提取tar文件:
tar -zxvf phpMyAdmin-4.7.5-all-languages.tar.gz
重命名提取的文件夹:
mv phpMyAdmin-4.7.5-all-languages phpmyadmin
创建Apache配置文件:
vim /etc/httpd/conf.d/phpmyadmin.conf
添加以下配置:
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require all granted
Require ip 127.0.0.1
Require ip ::1
</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
</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>
# These directories do not require access over HTTP - taken from the ortheitroadnal
# phpmyadmin upstream tar包
#<Directory /usr/share/phpmyadmin/libraries/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpmyadmin/setup/frames/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
保存文件并重新启动httpd服务器:
systemctl restart httpd
我们完成了!!打开phpmyadmin类型http://server_ip/phpmyadmin,我们应该看到登录页面。

