I want to read the apache2 error log file from PHP (it is currently owned by the www-data user)
Is it safe to change the owner of this file, or to give it less restrictive permissions ?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
The reason the default configuration is to restrict access to the error log is that it can contain sensitive information regarding either your configuration, or records of warnings/errors that contain usernames, passwords, database connection strings etc.
Allowing the webserver itself (read-only) access to that error log increases the risk for unauthorized access to such information.
But only you can do a risk analysis and judge if the benefits outweigh the risks.