普通网友 2015-01-30 13:15
浏览 162

Apache用户 - 权限被拒绝

I have a problem with my Apache user. He seems to have no right on linux system. I use CentOS 7, Apache 2.4.6, PHP 5.5.21. The apache user is apache:apache When I try to use chmod() or fopen() I get "Permission denied" So I have created a file named info.php :

-rwxrwxrwx.  1 apache apache   50 Jan 30 13:55 info.php

In this file I just added this line :

<?php chmod("info.php", 777); ?>

And the result is :

Warning: chmod(): Permission denied in /var/www/html/info.php on line 1

So I think that the probelm is, system user Apache has no rights but I don't know how can I fix tis?

Thanks.

EDIT : fix php code

  • 写回答

1条回答

  • dpjw67160 2015-01-30 14:50
    关注

    You are calling the chmod with wrong parameter.

    chmod("filename", 0777);
    

    Please refer to the PHP manual http://php.net/manual/en/function.chmod.php

    评论

报告相同问题?

悬赏问题

  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献