终于把fedora20下apache的权限问题解决了

最近半年,在学习弱语言php,因为想换行业所以学习编程,这几天在学写入的函数,但做实验的时候,发现权限不够。然后度娘了一下,网上普遍说
#chmod 0755 
#chmod 0777
就可以了,但运行时还是提示权限不够。

第二天找到了说是用户和组的不同,然后运用了
#chown -R apache:apache 
把项目的目录全部换成apache的用户和组,但还是显示权限不够。


经过几天的反复重装
分别通过yum安装lamp,源码编译lamp,安装xampp(别名:lampp)。等均为显示权限不够。


中途也看到有网友说设置
/etc/httpd/conf/httpd.conf
Directory
下的代码可以修改权限,修改后发现响应了另外一个错误,并且目录下没有生成我想要的文件。


在看到的一遍博文中提到,通过看apache的手册修改了一些变量。然后想起有F&Q这个目录。
http://wiki.apache.org/httpd/FAQ
搜索了一下关键字      Permission
发现一个提示 以下是原文
why do I get a "Forbidden" message whenever I try to access a particular directory?
This message is generally caused because either


//所在的文件系统的权限不允许apache所在的用户/组运行访问必要的文件
The underlying file system permissions do not allow the User/Group under which Apache is running to access the necessary files; or

//Apache配置有访问限制禁止访问文件
The Apache configuration has some access restrictions in place which forbid access to the files.

//可以通过检查差误日志判断出错的地方
You can determine which case applies to your situation by checking the error log.

//进行修改后,文件系统还不够权限的话,可以查看(13) Permission Denied获取更多的信息
In the case where file system permission are at fault, see (13) Permission Denied for more info.


(13) Permission Denied   前面提到的是用chmod和chown来更改文件和目录权限的,对我都行不通,可以无视


后面说的

//所有方法用过后,你还是有权限错误的话,你应该检查extended-permissions。举个例子,你可以使用

If all the standard permissions are correct and you still get a Permission Denied error, you should check for extended-permissions. For example you can use the 


//命令 #setenforce 0临时关闭SELinux和检查一下程序的运行状况。行得通的话,#ls -alZ  可以查看SELinux的权限并且用chcon修复权限

command setenforce 0 to turn off SELinux and check to see if the problem goes away. If so, ls -alZ can be used to view SELinux permission and chcon to fix them.


因为是在家里的建服务器,不连网,我的解决方法就是直接关闭SELinux,因为为了赶进度,没有时间设置SELinux,

永久关闭SELinux修改/etc/selinux/config文件中设置SELINUX=disabled

注:SELINUX=enforcing(注:(默认值)Enforcing 代表记录警告且阻止可疑行为)

SELINUX=permissive(注:Permissive 代表仅记录安全警告但不阻止可疑行为)

SELINUX=disabled(注:Disabled 代表 SELinux 被禁用)


问题解决了,可以创建文件,还是赶紧学完php,找到工作再深入研究SELinux,家里的意见不是一般的大

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值