普通网友 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 gwas 分析-数据质控之过滤稀有突变中出现的问题
  • ¥15 没有注册类 (异常来自 HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
  • ¥15 知识蒸馏实战博客问题
  • ¥15 用PLC设计纸袋糊底机送料系统
  • ¥15 simulink仿真中dtc控制永磁同步电机如何控制开关频率
  • ¥15 用C语言输入方程怎么
  • ¥15 网站显示不安全连接问题
  • ¥15 51单片机显示器问题
  • ¥20 关于#qt#的问题:Qt代码的移植问题
  • ¥50 求图像处理的matlab方案