普通网友 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

    评论

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大