php 403 Forbidden : 您无权访问
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22888216/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
403 Forbidden : You don't have permission to access
提问by user3502444
Forbidden
You don't have permission to access /install/step3.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
禁止的
您无权访问此服务器上的 /install/step3.php。
此外,在尝试使用 ErrorDocument 处理请求时遇到 404 Not Found 错误。
Why is it showing this error when I'm trying to install a script?
为什么在我尝试安装脚本时会显示此错误?
回答by Go Namhyeon
Your question have 2 configuration problem.
你的问题有2个配置问题。
- File Permission (in Filesystem)
- ErrorDocument Attribute (in Apache Webserver)
- 文件权限(在文件系统中)
- ErrorDocument 属性(在 Apache Web 服务器中)
First, You can solve permission error using 'chmod' and 'chown' command.
首先,您可以使用 'chmod' 和 'chown' 命令解决权限错误。
try this:
尝试这个:
- chmod -R 777 directory (777 means allow permission for all)
- chown -R [user]:[group] directory (generally, the same [user] and [group])
- chmod -R 777 目录(777 表示允许所有权限)
- chown -R [user]:[group]目录(一般是[user]和[group]相同)
Second, ErrorDocument handle error can occured from invaild ErrorDocument attribute setting in .htacess or httpd.conf(or apache2.conf) file.
其次,ErrorDocument 句柄错误可能来自 .htacess 或 httpd.conf(或 apache2.conf)文件中无效的 ErrorDocument 属性设置。
try this:
尝试这个:
- check your .htacess file in 'install/' directory. If you can not check this file, you can try 'ls -al' command in terminal. you have to find 'ErrorDocument' attribute, and remove or correct it.
- check your apache webserver configuration file (httpd.conf or apache2.conf). If you can check 'ErrorDocument' attribute, you can try remove this attribute in file. It is temporary, so you must backup it before try suggested cases.
- If you can not solve by case 1 and 2, you can try disable 'AllowOverride' attribute. Try find 'AllowOverride x' attribute and replace to 'AllowOverride None'. Because, this problem can have possiblity from .htacess file in parent directories. AllowOverride attribute can control allow or deny additional configuration in .htacess file.
- You must restart apache service after try this cases. you can try 'service httpd restart' or 'service apache2 restart' command.
- 检查“install/”目录中的 .htacess 文件。如果您无法检查此文件,您可以在终端中尝试 'ls -al' 命令。您必须找到“ErrorDocument”属性,然后删除或更正它。
- 检查您的 apache 网络服务器配置文件(httpd.conf 或 apache2.conf)。如果您可以检查“ErrorDocument”属性,则可以尝试在文件中删除此属性。它是临时的,因此您必须在尝试建议的案例之前对其进行备份。
- 如果您无法通过案例 1 和 2 解决,您可以尝试禁用 'AllowOverride' 属性。尝试找到“AllowOverride x”属性并替换为“AllowOverride None”。因为,这个问题可能来自父目录中的 .htacess 文件。AllowOverride 属性可以控制允许或拒绝 .htacess 文件中的其他配置。
- 尝试这种情况后,您必须重新启动 apache 服务。您可以尝试“service httpd restart”或“service apache2 restart”命令。
Good luck to your web server and you.
祝您和您的 Web 服务器好运。
回答by Galilo Galilo
I have faced this problem. On local host it was running as I want, but when deployed (using Filezilla in my case) on the remote server, the problem occurred. with error 403 instead of 404. I think as mentioned before, It is a restricted access from the server. I only reuploaded the whole folder and every thing is perfect now. Thanks to this community.
我遇到过这个问题。在本地主机上,它按我的意愿运行,但是在远程服务器上部署(在我的情况下使用 Filezilla)时,出现了问题。错误 403 而不是 404。我认为如前所述,这是来自服务器的受限访问。我只重新上传了整个文件夹,现在一切都很完美。感谢这个社区。
回答by steviejay
First thing to do is check that the index.html is written in properly. Forbidden 403 usually indicates that the server is running but that the requested resource is not being found. Then clear your cache. Additionally check your php.ini file to configure any necessary items to get your website running.
首先要做的是检查 index.html 是否正确写入。Forbidden 403 通常表示服务器正在运行但未找到请求的资源。然后清除缓存。另外检查您的 php.ini 文件以配置任何必要的项目以使您的网站运行。
The Web server (running the Web site) thinks that the HTTP data stream sent by the client (e.g. your Web browser or our CheckUpDown robot) was correct, but access to the resource identified by the URL is forbidden for some reason.
This indicates a fundamental access problem, which may be difficult to resolve because the HTTP protocol allows the Web server to give this response without providing any reason at all. So the 403 error is equivalent to a blanket 'NO' by the Web server - with no further discussion allowed.
By far the most common reason for this error is that directory browsing is forbidden for the Web site. Most Web sites want you to navigate using the URLs in the Web pages for that site. They do not often allow you to browse the file directory structure of the site. For example try the following URL (then hit the 'Back' button in your browser to return to this page):
http://www.checkupdown.com/accounts/grpb/B1394343/
This URL should fail with a 403 error saying "Forbidden: You don't have permission to access /accounts/grpb/B1394343/ on this server". This is because our CheckUpDown Web site deliberately does not want you to browse directories - you have to navigate from one specific Web page to another using the hyperlinks in those Web pages. This is true for most Web sites on the Internet - their Web server has "Allow directory browsing" set OFF.
Web 服务器(运行网站)认为客户端(例如您的 Web 浏览器或我们的 CheckUpDown 机器人)发送的 HTTP 数据流是正确的,但由于某种原因禁止访问由 URL 标识的资源。
这表明存在根本性的访问问题,可能难以解决,因为 HTTP 协议允许 Web 服务器在不提供任何理由的情况下给出此响应。因此,403 错误相当于 Web 服务器的一揽子“否” - 不允许进一步讨论。
到目前为止,此错误的最常见原因是该网站禁止目录浏览。大多数网站都希望您使用该网站网页中的 URL 进行导航。它们通常不允许您浏览站点的文件目录结构。例如,尝试以下 URL(然后点击浏览器中的“返回”按钮返回此页面):
http://www.checkupdown.com/accounts/grpb/B1394343/
此 URL 应失败并显示 403 错误,提示“禁止访问:您无权访问此服务器上的 /accounts/grpb/B1394343/”。这是因为我们的 CheckUpDown 网站故意不希望您浏览目录 - 您必须使用这些网页中的超链接从一个特定网页导航到另一个网页。对于 Internet 上的大多数 Web 站点来说都是如此 - 他们的 Web 服务器将“允许目录浏览”设置为关闭。
回答by alpc
.htaccess
.htaccess
ErrorDocument 404 /index.php
ErrorDocument 403 /index.php
ErrorDocument 403.14 /index.php
ErrorDocument 500 /index.php