Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
禁止:你不';我没有权限访问此服务器上的/phpmyadmin_Php_Mysql_Phpmyadmin - Fatal编程技术网

禁止:你不';我没有权限访问此服务器上的/phpmyadmin

禁止:你不';我没有权限访问此服务器上的/phpmyadmin,php,mysql,phpmyadmin,Php,Mysql,Phpmyadmin,您好,我已在centos计算机上安装了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 d

您好,我已在centos计算机上安装了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>
#phpMyAdmin-用php编写的基于Web的MySQL浏览器
# 
#默认情况下仅允许本地主机
#
#但是应该考虑允许phpMyAdmin访问本地主机以外的任何人
#危险,除非通过SSL进行适当保护
别名/phpMyAdmin/usr/share/phpMyAdmin
别名/phpmyadmin/usr/share/phpmyadmin
#Apache2.4
要求ip 127.0.0.1
需要ip::1
#Apache2.2
命令拒绝,允许
全盘否定
允许从127.0.0.1开始
允许来自::1
#Apache2.4
要求ip 127.0.0.1
需要ip::1
#Apache2.2
命令拒绝,允许
全盘否定
允许从127.0.0.1开始
允许来自::1
#这些目录不需要通过HTTP访问-从原始目录获取
#塔巴尔上游的phpMyAdmin
#
命令拒绝,允许
全盘否定
从无到有
命令拒绝,允许
全盘否定
从无到有
命令拒绝,允许
全盘否定
从无到有
#此配置可防止phpMyAdmin目录中的mod_安全性受到攻击
#过滤SQL等。这可能会破坏您的mod_安全实现。
#
#
#    
#保密
#    
#
请帮我解决这个问题。任何线索都很感激


谢谢

您需要遵循以下步骤:

找到下面的行

Require ip 127.0.0.1
替换为您的工作站IP地址:

Require ip 10.1.3.53
再次查找以下行:

Allow from 127.0.0.1
替换如下:

Allow from 10.1.3.53
还可以从所有中找到
deny并在整个文件中对其进行注释

保存并关闭文件。
重新启动Apache httpd服务器

# service httpd restart

编辑:由于这是选定的答案,并获得最佳可见性。。。还请确保安装了PHP,否则会出现相同的
禁止
错误。

首先编辑文件/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>

命令拒绝,允许
全盘否定
允许从127.0.0.1开始
允许从192.168.1.0/15开始
如果您想允许访问所有人,则可以将其更改为:

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

命令允许,拒绝
通融
在文件的所有部分中允许

重新启动(服务httpd重新启动)就足够了

经过两天的严格研究,我发现了这一点,(找到了它),并且对我来说非常合适。

允许所有人:

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

编辑文件:
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>
<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>

AddDefaultCharset UTF-8
#Apache2.4
#Apache2.2
重启Apache:
服务httpd重启


(phpMyAdmin v4.0.10.8)

上述配置在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
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
   </IfModule>
</Directory>
<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>

AddDefaultCharset UTF-8
#Apache2.4
#要求ip 127.0.0.1
#需要ip::1
要求所有授权
#Apache2.2
命令拒绝,允许
全盘否定
允许从127.0.0.1开始
允许来自::1

在CENTOS7上的新安装中,我尝试了上述方法(编辑phpMyAdmin.conf和添加Require all-grated),但仍然不起作用。以下是解决方案:安装
mod_php
模块:

$ sudo yum install php
然后重新启动httpd:

$ sudo systemctl restart httpd

得票最多的答案的问题在于它不能解释解决方案的理由

对于要求ip 127.0.0.1的行
,您应该添加计划从浏览器访问phpMyAdmin的主机的ip地址。例如,
要求ip 192.168.0.100
requireIP127.0.0.1
允许本地主机访问phpMyAdmin


进行更改后重新启动apache(httpd)。我建议您在本地主机上进行测试,或者使用命令行工具(如curl)来实现http GET,这样就不会有其他配置问题。

您只需转到phpmyadmin.conf文件并将“拒绝来自所有人”更改为“允许来自所有人”。
它对我很有效,希望对你也有效。

Centos 7 php安装附带安装并启用的ModSecurity软件包,可防止web访问phpMyAdmin。在phpMyAdmin.conf的末尾,您应该找到

# 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>
在“Directory/usr/share/phpMyAdmin/”块中,您可以解决对phpMyAdmin的“拒绝访问”,但可能会造成安全问题

并用从上述链接获得的工作站IP地址替换127.0.0.1

. . .
Require ip your_workstation_IP_address
. . .
Allow from your_workstation_IP_address
. . .
Require ip your_workstation_IP_address
. . .
Allow from your_workstation_IP_address
. . .
最后,别忘了重新启动服务器

sudo systemctl restart httpd.service

至少具有最新版本的phpmyadmin 5.0.2+

检查实际安装是否正确完成

我的文件被复制到linux机器上的一个子文件夹中,而不是在

/usr/share/phpmyadmin/

在appserver中,我遇到了同样的问题,我转到“C:\AppServ\Apache24\conf\extra”文件夹,从中修改httpd-vhosts.conf文件

<VirtualHost _default_:80>
DocumentRoot "${SRVROOT}/htdocs"
#ServerName www.example.com:80
</VirtualHost>

DocumentRoot“${SRVROOT}/htdocs”
#ServerName www.example.com:80


DocumentRoot“C:\AppServ\www”
#ServerName www.example.com:80

但我说的是Lamp而不是wamp FYIYou目前只允许本地主机访问
usr/share/phpmyadmin
出于安全考虑,我建议只添加IP的白名单。可能重复您的意思是用我的机器IP替换127.0.0.1。我也这样做过,但这个错误仍然存在。ans对我不起作用。任何帮助@DaemonOfTheWest,这是做什么的?@gwg-如果任何人找到一个有效的用户/密码组合,他们可以访问