php出现操作文件没有权限的解决办法:
1.查看apache配置的用户和用户组
#vi /etc/httpd/conf/httpd.conf
## if you wish httpd to run as a different user or group, you must run# httpd as root initially and it will switch.## user/group: the name (or #number) of the user/group to run httpd as.# it is usually good practice to create a dedicated user and group for# running httpd, as with most system services.#user apachegroup apache
可以看到user和group 都是 apache。
2.修改你要操作的文件夹用户和权限,将用户就改为和apache配置一样,将权限修改为755:
#chown -r apache:apache your_folder#chmod -r 755 your_folder
3.按理说到这步应该问题就解决了,可是这天使用的是刚装的新系统,selinux需要关闭
关闭selinux:
#vi /etc/selinux/config#selinux=enforcing #注释掉#selinuxtype=targeted #注释掉selinux=disabled #增加:wq! #保存退出#setenforce 0 #使配置立即生效
相关学习推荐:php编程从入门到精通
以上就是php出现操作文件没有权限怎么办?的详细内容。
