简体   繁体   English

Linux Apache2 PHP 5.3日志文件的正确权限是什么?

[英]What are correct permissions for Linux Apache2 PHP 5.3 log file?

I discovered the reason why I was not getting entries into my php_errors.log file related to permissions. 我发现了为什么我没有在与权限相关的php_errors.log文件中获取条目的原因。 Right now, I have set it to 666 (rw-rw-rw-) but surely this is a security weakness? 现在,我已将其设置为666(rw-rw-rw-),但可以肯定这是安全漏洞吗? Thus, my question. 因此,我的问题。

php.ini file: error_log /var/log/httpd/php_errors.log log_errors On php.ini文件:error_log /var/log/httpd/php_errors.log log_errors开

# ls -ld /var/log /var/log/httpd /var/log/httpd/php_errors.log
drwxr-xr-x 6 root     root     4096 Jun 21 03:32 /var/log
drwxr-xr-x 2 ec2-user ec2-user 4096 Jun 22 10:16 /var/log/httpd
-rw-rw-rw- 1 ec2-user ec2-user   63 Jun 22 10:33 /var/log/httpd/php_errors.log

(Many thanks in advance) (提前谢谢了)

I'd simply set its owner to apache user. 我只是将其所有者设置为apache用户。

This will give you the name of apache user : 这将为您提供apache用户的名称:

ps aux | grep httpd

In my case (CentOS), it's 'apache' but sometimes it's 'www-data'... 就我而言(CentOS),是“ apache”,但有时是“ www-data” ...

chown apache:apache /var/log/httpd/php_errors.log
chmod 600 /var/log/httpd/php_errors.log

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM