禁止:您无权访问此服务器上的/ phpmyadmin

您好我已经在我的机器上安装了phpmyadmin,当我试图通过我的浏览器打到phpmyadmin我得到这个错误:

 Forbidden You don't have permission to access `phpmyadmin` on this server. 

我的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> 

请帮我解决这个问题。 任何领导表示赞赏。

谢谢

上面的configuration在我的CentOS 7服务器上都没有工作。 经过几个小时的search,那对我有用:

编辑文件phpMyAdmin.conf

sudo nano /etc/httpd/conf.d/phpMyAdmin.conf

并将其replace为顶部:

 <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> 

您需要遵循以下步骤:

查找下面的行

 Require ip 127.0.0.1 

用您的工作站IP地址replace:

 Require ip 10.1.3.53 

再次find以下行:

 Allow from 127.0.0.1 

replace如下:

 Allow from 10.1.3.53 

也finddeny from all并在整个文件中评论它。

保存并closures文件。 Restart Apache httpd server

 # service httpd restart 

在CENTOS7上全新安装我已经尝试了上述方法(编辑phpMyAdmin.conf并添加要求所有授予),它仍然没有工作。 这里是解决scheme:安装mod_php模块:

 $ sudo yum install php 

然后重新启动httpd:

 $ sudo systemctl restart httpd 

瞧!

转到C:\ wamp \ alias。 打开文件phpmyadmin.conf并更改

 <Directory "c:/wamp/apps/phpmyadmin3.5.1/"> Options Indexes FollowSymLinks MultiViews AllowOverride all Order Deny,Allow Deny from all Allow from 127.0.0.1 </Directory> 

 <Directory "c:/wamp/apps/phpmyadmin3.5.1/"> Options Indexes FollowSymLinks MultiViews AllowOverride all Order Allow,Deny Allow from all </Directory> 

进行这些更改后重新启动Apache服务器。

问题解决了

编辑文件: sudo nano /etc/httpd/conf.d/phpMyAdmin.conf并用下面的代码replace你的:

 <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> 

重新启动Apache: service httpd restart

(phpMyAdmin v4.0.10.8)

答案最多的问题是没有解释解决scheme的推理。

对于Require ip 127.0.0.1 ,你应该添加计划从浏览器访问phpMyAdmin的主机的IP地址。 例如Require ip 192.168.0.100Require ip 127.0.0.1允许localhost访问phpMyAdmin。

进行更改后重新启动apache(httpd)。 我会build议在本地主机上testing,或者使用像curl这样的命令行工具,来获得一个很好的http GETfunction,而且没有其他的configuration问题。

首先编辑文件/etc/httpd/conf.d/phpMyAdmin.conf并将其他行添加到目录设置:

 <Directory /usr/share/phpMyAdmin/> order deny,allow deny from all allow from 127.0.0.1 allow from 192.168.1.0/15 </Directory> 

如果您想允许访问所有人,那么您可以将其更改为:

 <Directory /usr/share/phpMyAdmin/> order allow,deny allow from all </Directory> 

允许在文件的所有部分。

重启(service httpd restart)就足够了。

经过2天的严格研究,我find了这个(在这里find它),并为我工作。

你可以简单地去phpmyadmin.conf文件,并将“拒绝所有”改为“全部允许”。 那么它为我工作,希望它也适用于你。

允许所有人:

 #Require ip 127.0.0.1 #Require ip ::1 Require all granted