I'd like to point out that giving write access to /var/log/ is a bad idea. Write access to /var/log/ means that an attacker can overwrite any of your logs, making it impossible to track down an attack on your server. If you wish to log from PHP, either make a single directory just for your php script's log (say, /var/log/php/) and give write access to it, or use syslog() and related functions to write to the standard system logs.
For read access, you'll need to determine what is creating the log files and make sure they're created with permissions that allow the user PHP is running as to read them. You can change them manually, but next time logs are rotated and new log files are created, you will probably have to change them again.
One of the most straight-forward ways to do this is to ensure that the user
who is running the PHP script has the required access.
You can use chmod to modify permissions and chown/chgrp to change ownerships
as necessary.
I'd like to point out that giving write access to
/var/log/
is a bad idea. Write access to/var/log/
means that an attacker can overwrite any of your logs, making it impossible to track down an attack on your server. If you wish to log from PHP, either make a single directory just for your php script's log (say,/var/log/php/
) and give write access to it, or use syslog() and related functions to write to the standard system logs.For read access, you'll need to determine what is creating the log files and make sure they're created with permissions that allow the user PHP is running as to read them. You can change them manually, but next time logs are rotated and new log files are created, you will probably have to change them again.
Find out which user php is running as and chmod the files/directories to match.
Quick and dirty way to find out:
One of the most straight-forward ways to do this is to ensure that the user who is running the PHP script has the required access. You can use chmod to modify permissions and chown/chgrp to change ownerships as necessary.