Hi I have installed phpmyadmin on my centos machine and when I try to hit phpmyadmin
through my browser I get this error :
Hi,我在centos机器上安装了phpmyadmin,当我试图通过浏览器访问phpmyadmin时,我得到了这个错误:
Forbidden
You don't have permission to access `phpmyadmin` on this server.
My phpmyadmin.conf
file has following content:
我的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>
Kindly help me resolve this issue. Any lead is appreciated.
请帮我解决这个问题。任何领导赞赏。
Thanks
谢谢
8 个解决方案
#1
70
None of the configuration above worked for me on my CentOS 7 server. After hours of searching, that what worked for me:
上面的配置没有在我的CentOS 7服务器上为我工作。经过几个小时的搜寻,我终于明白了:
Edit file phpMyAdmin.conf
编辑文件phpMyAdmin.conf
sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
And replace this at the top:
然后把这个替换到顶部:
<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>
#2
25
On a fresh install on CENTOS7 I have tried the above methods (edit phpMyAdmin.conf and add Require all granted), it still does'nt work. Here is the solution : install the mod_php module :
在CENTOS7的新安装上,我尝试了上述方法(编辑phpMyAdmin)。conf和add要求都是允许的),它仍然不能工作。下面是解决方案:安装mod_php模块:
$ sudo yum install php
then restart httpd :
然后重新启动httpd:
$ sudo systemctl restart httpd
and voila !
瞧!
#3
23
You need to follow the following steps:
你需要遵循以下步骤:
Find line that read follows
查找下面读的行。
Require ip 127.0.0.1
Replace with your workstation IP address:
更换你的工作站IP地址:
Require ip 10.1.3.53
Again find the following line:
再一次找到以下一行:
Allow from 127.0.0.1
Replace as follows:
替换如下:
Allow from 10.1.3.53
Also find deny from all
and comment it in the entire file.
也可以在整个文件中找到否定和注释。
Save and close the file.Restart Apache httpd server
:
保存并关闭文件。重新启动Apache httpd服务器:
# service httpd restart
#4
6
Edit file: sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
and replace yours with following:
编辑文件: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>
Restart Apache: service httpd restart
重启Apache:服务httpd重启。
(phpMyAdmin v4.0.10.8)
(phpMyAdmin v4.0.10.8)
#5
2
The problem with the answer with the most votes is it doesn't explain the reasoning for the solution.
答案最多的问题是,它不能解释解决方案的理由。
For the lines Require ip 127.0.0.1
, you should instead add the ip address of the host that plans to access phpMyAdmin from a browser. For example Require ip 192.168.0.100
. The Require ip 127.0.0.1
allows localhost access to phpMyAdmin.
对于需要ip 127.0.0.1的行,您应该添加主机的ip地址,该地址计划从浏览器访问phpMyAdmin。例如,需要ip 192.168.0.100。要求ip 127.0.0.1允许本地主机访问phpMyAdmin。
Restart apache (httpd) after making changes. I would suggest testing on localhost, or using command line tools like curl to very a http GET works, and there is no other configuration issue.
更改后重新启动apache (httpd)。我建议在本地主机上进行测试,或者使用像curl这样的命令行工具来进行http GET工作,并且没有其他配置问题。
#6
1
First edit the file /etc/httpd/conf.d/phpMyAdmin.conf and add the additional line to the directory settings:
首先编辑文件/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>
If you wanted to allow access to everybody then you could just change it to:
如果你想让每个人都能接触到,那么你可以把它改成:
<Directory /usr/share/phpMyAdmin/>
order allow,deny
allow from all
</Directory>
Allow in all sections of the file.
允许在文件的所有部分。
A restart (service httpd restart) is enough to pick this up.
重新启动(服务httpd重启)就足够了。
I found this after 2 days rigorous research, (find it here) and worked just right for me.
经过两天严格的研究,我发现了这一点,(在这里找到了),而且我的工作正好适合我。
#7
0
You could simply go to phpmyadmin.conf file and change "deny from all" to "allow from all". Well it worked for me, hope it works for you as well.
你可以直接去phpmyadmin。conf文件和更改“拒绝所有”,以“允许所有”。这对我很有效,希望对你也有用。
#8
-1
To allow from all:
允许从:
#Require ip 127.0.0.1
#Require ip ::1
Require all granted
#1
70
None of the configuration above worked for me on my CentOS 7 server. After hours of searching, that what worked for me:
上面的配置没有在我的CentOS 7服务器上为我工作。经过几个小时的搜寻,我终于明白了:
Edit file phpMyAdmin.conf
编辑文件phpMyAdmin.conf
sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
And replace this at the top:
然后把这个替换到顶部:
<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>
#2
25
On a fresh install on CENTOS7 I have tried the above methods (edit phpMyAdmin.conf and add Require all granted), it still does'nt work. Here is the solution : install the mod_php module :
在CENTOS7的新安装上,我尝试了上述方法(编辑phpMyAdmin)。conf和add要求都是允许的),它仍然不能工作。下面是解决方案:安装mod_php模块:
$ sudo yum install php
then restart httpd :
然后重新启动httpd:
$ sudo systemctl restart httpd
and voila !
瞧!
#3
23
You need to follow the following steps:
你需要遵循以下步骤:
Find line that read follows
查找下面读的行。
Require ip 127.0.0.1
Replace with your workstation IP address:
更换你的工作站IP地址:
Require ip 10.1.3.53
Again find the following line:
再一次找到以下一行:
Allow from 127.0.0.1
Replace as follows:
替换如下:
Allow from 10.1.3.53
Also find deny from all
and comment it in the entire file.
也可以在整个文件中找到否定和注释。
Save and close the file.Restart Apache httpd server
:
保存并关闭文件。重新启动Apache httpd服务器:
# service httpd restart
#4
6
Edit file: sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
and replace yours with following:
编辑文件: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>
Restart Apache: service httpd restart
重启Apache:服务httpd重启。
(phpMyAdmin v4.0.10.8)
(phpMyAdmin v4.0.10.8)
#5
2
The problem with the answer with the most votes is it doesn't explain the reasoning for the solution.
答案最多的问题是,它不能解释解决方案的理由。
For the lines Require ip 127.0.0.1
, you should instead add the ip address of the host that plans to access phpMyAdmin from a browser. For example Require ip 192.168.0.100
. The Require ip 127.0.0.1
allows localhost access to phpMyAdmin.
对于需要ip 127.0.0.1的行,您应该添加主机的ip地址,该地址计划从浏览器访问phpMyAdmin。例如,需要ip 192.168.0.100。要求ip 127.0.0.1允许本地主机访问phpMyAdmin。
Restart apache (httpd) after making changes. I would suggest testing on localhost, or using command line tools like curl to very a http GET works, and there is no other configuration issue.
更改后重新启动apache (httpd)。我建议在本地主机上进行测试,或者使用像curl这样的命令行工具来进行http GET工作,并且没有其他配置问题。
#6
1
First edit the file /etc/httpd/conf.d/phpMyAdmin.conf and add the additional line to the directory settings:
首先编辑文件/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>
If you wanted to allow access to everybody then you could just change it to:
如果你想让每个人都能接触到,那么你可以把它改成:
<Directory /usr/share/phpMyAdmin/>
order allow,deny
allow from all
</Directory>
Allow in all sections of the file.
允许在文件的所有部分。
A restart (service httpd restart) is enough to pick this up.
重新启动(服务httpd重启)就足够了。
I found this after 2 days rigorous research, (find it here) and worked just right for me.
经过两天严格的研究,我发现了这一点,(在这里找到了),而且我的工作正好适合我。
#7
0
You could simply go to phpmyadmin.conf file and change "deny from all" to "allow from all". Well it worked for me, hope it works for you as well.
你可以直接去phpmyadmin。conf文件和更改“拒绝所有”,以“允许所有”。这对我很有效,希望对你也有用。
#8
-1
To allow from all:
允许从:
#Require ip 127.0.0.1
#Require ip ::1
Require all granted