简体   繁体   English

您无权在Apache PHP中访问/marcon/assets/images/pic.jpg

[英]You don't have permission to access /marcon/assets/images/pic.jpg in apache php

I am getting this error You don't have permission to access /marcon/assets/images/pic.jpg in apache php on my local Fedora 17, php,mysql and apache(not Xampp installation). 我收到此错误您没有权限在本地Fedora 17上的apache php中访问/marcon/assets/images/pic.jpg,php、mysql和apache(不是Xampp安装)。 This error is occuring for any new files that I am copying to the directory.The older files /marcon/assets/images/header.jpg are accessible just fine. 我复制到目录中的所有新文件都发生此错误。可以访问旧文件/marcon/assets/images/header.jpg。 I checked the permissions and they are 777 (now) but still doesn't work. 我检查了权限,它们是777(现在),但仍然无法正常工作。 This is a very wierd error. 这是一个非常奇怪的错误。 The subdirectory and other images work fine. 子目录和其他图像工作正常。 Just the newer files don't work 只是较新的文件不起作用

This happens when I embed it as an image as well as when I access it directly. 当我将其嵌入为图像以及直接访问它时,就会发生这种情况。 It works for all other files in the directory. 它适用于目录中的所有其他文件。 Not just the newer ones 不只是较新的

EDIT: Ironically this problem doesn't occur if i check the files into github and clone the project back again. 编辑: 具有讽刺意味的是,如果我将文件检入github并再次克隆该项目,则不会发生此问题。 Everything works hunky dory. 一切正常,笨拙。

It is SElinux issue: 这是SElinux问题:

Try 尝试

$ ls -Z file1

you should get something similar to: 您应该获得类似于以下内容的信息:

drwxr-xr-x. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 scripts

if no try: 如果没有尝试:

chcon -R -t httpd_sys_content_t  /marcon/assets/images

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM