Meg*_*rma 57 php mysql phpmyadmin
嗨我已经在我的centos机器上安装了phpmyadmin,当我尝试phpmyadmin通过我的浏览器时,我收到此错误:
Forbidden
You don't have permission to access `phpmyadmin` on this server.
Run Code Online (Sandbox Code Playgroud)
我的phpmyadmin.conf文件有以下内容:
# phpMyAdmin - Web based MySQL browser written in php
#
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
<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>
<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 original
# phpMyAdmin upstream tarball
#
<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>
# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc. This may break your mod_security implementation.
#
#<IfModule mod_security.c>
# <Directory /usr/share/phpMyAdmin/>
# SecRuleInheritance Off
# </Directory>
#</IfModule>
Run Code Online (Sandbox Code Playgroud)
请帮我解决这个问题.任何领导都表示赞赏.
谢谢
Hyd*_* B. 97
上面的配置都没有在我的CentOS 7服务器上工作.经过几个小时的搜索,这对我有用:
编辑文件phpMyAdmin.conf
sudo nano /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>
Run Code Online (Sandbox Code Playgroud)
Edo*_*iel 40
在CENTOS7上全新安装我尝试了上面的方法(编辑phpMyAdmin.conf并添加Require all grant),它仍然无法正常工作.这是解决方案:安装mod_php模块:
$ sudo yum install php
Run Code Online (Sandbox Code Playgroud)
然后重启httpd:
$ sudo systemctl restart httpd
Run Code Online (Sandbox Code Playgroud)
瞧!
Meg*_*rma 33
您需要按照以下步骤操作:
查找以下内容的行
Require ip 127.0.0.1
Run Code Online (Sandbox Code Playgroud)
替换为您的工作站IP地址:
Require ip 10.1.3.53
Run Code Online (Sandbox Code Playgroud)
再次找到以下行:
Allow from 127.0.0.1
Run Code Online (Sandbox Code Playgroud)
替换如下:
Allow from 10.1.3.53
Run Code Online (Sandbox Code Playgroud)
还可以deny from all在整个文件中查找并注释它.
保存并关闭文件.Restart Apache httpd server:
# service httpd restart
Run Code Online (Sandbox Code Playgroud)
小智 7
允许所有人:
#Require ip 127.0.0.1
#Require ip ::1
Require all granted
Run Code Online (Sandbox Code Playgroud)
编辑文件:sudo nano /etc/httpd/conf.d/phpMyAdmin.conf并将以下内容替换为:
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
</IfModule>
</Directory>
Run Code Online (Sandbox Code Playgroud)
重启Apache: service httpd restart
(phpMyAdmin v4.0.10.8)