douzhong6480
2014-07-16 18:24
浏览 48
已采纳

我如何知道我的php进程是否具有写入文件的正确权限?

I turned on error logging in php.ini file.

error_log `/etc/httpd/logs/error_log`

error_reporting `22527`

I try triggering an error by using trigger_error() function. However, nothing gets written to the file. File is not even created. I'm guessing there are permission errors but how can I tell?

图片转代码服务由CSDN问答提供 功能建议

我打开了php.ini文件中的错误记录。

  error_log` / etc / httpd / logs / error_log` 
 
error_reporting`22527` 
   
 
 

I 尝试使用 trigger_error()功能触发错误。 但是,没有任何内容写入文件。 甚至没有创建文件。 我猜是有许可错误,但我怎么知道?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongna1593 2014-07-16 18:28
    已采纳

    http://php.net/manual/en/function.is-writable.php

    bool is_writable ( string $filename )
    

    returns TRUE if the filename exists and is writable.

    That being said, logs generally go in /var/log/ or /var/apache2/log or somewhere other than /etc/ as

    /etc

    This is the nerve center of your system, it contains all system related configuration files in here or in its sub-directories

    If you mess something up in /etc/ it will be really, really bad.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题