您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php操作文件提示没有权限怎么办

2024/11/11 17:32:58发布97次查看
问题描述:
在本地使用php脚本操作文件可以成功,但是放到服务器上就不行。
查看apache日志:
#cd /var/log/httpd#tac error_log
显示:
cannot create directory '_test1': permission denied
解决方法:
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
#vi /etc/selinux/config#selinux=enforcing #注释掉#selinuxtype=targeted #注释掉selinux=disabled #增加:wq! #保存退出#setenforce 0 #使配置立即生效
更多相关教程请关注。
以上就是php操作文件提示没有权限怎么办的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product