PHP5 errorlog file permissions
| From: | php at karsites dot net | Date: | Mon, 20 Feb 2006 15:49:15 +0000 |
| Subject: | PHP5 errorlog file permissions | ||
| References: | 1 | Groups: | php.install |
| Request: | Send a blank email to php-install+get-17076@lists.php.net to get a copy of this message | ||
Hi all.
I'm running SuSE Linux 9.2 pro, Apache 2.2.0, Mysql 5.0.18,
and php 5.1.2.
I'm wondering what user & permissions to set the php error
log file to?
Sometimes php will write to the Apache 2 log file (or Apache
will, on php's behalf), if php cannot access the error_log
file, which is currently set to:
error_log=/var/log/apache-2.2.0/php_errors
Here are the permissions for the log file directory:
Permission Nl Owner Group Size MTime Name
drwxr-xr-x root root UP--DIR ..
-rw-r--r-- root root 2244 Feb 20 15:24 ROBOT_LOG
-rw-r--r-- root root 4156 Feb 20 15:24 access_log
-rw-r--r-- root root 2244 Feb 20 15:24 browser_log
-rw-r--r-- root root 10548 Feb 20 15:24 combined_access_log
-rw-r--r-- root root 542 Feb 20 15:24 error_log
-rw-r--r-- wwwrun nogroup 5322 Feb 20 15:24 php_errors
-rw-r--r-- root root 5986 Feb 20 15:24 referer_log
Are these permissions safe to use, as I read somewhere that
only root should be able to write to the directory with the
log files in?
If I set the owner and group of php_errors to root:root
then I have to set the permissions to -rw-rw-rw-, otherwise
php cannot write the php_errors file, and will write php
errors into the apache error_log instead.
So it seems like I have to set the permissions as above, or
just have php write to the apache error_log, under
root:root, which I suspect would be the safest option?
Any suggestions would be welcome.
Keith
In theory, theory and practice are the same;
In practice they are not.