13

The FPM log file located in /var/log/php-fpm.log has permissions rw------- (600). Other log files have rw-r--r--. How can I configure the file permission to 644?

Rohit
  • 310
  • 3
  • 7

2 Answers2

2
chmod 644 /var/log/php-fpm.log
Jay
  • 6,544
  • 25
  • 34
  • 10
    Indeed, that works on an existing log file and is persistent across FPM restarts and server reboots. But if the file is being created for the first time (or if I delete it for some reason, say) the default permission on the new file is still 600. Is there any way to ensure 644 like for other programs' log files? – Rohit Mar 02 '13 at 15:01
  • Why not just create it yourself with `cd /var/log` `sudo touch php-fpm.log` `sudo chown correctUser:correctGroup php-fpm.log` `sudo chmod 644 php-fpm.log`? How often are you deleting it? – Eliezer Berlin Feb 19 '23 at 10:50
0

Set the logging of PHP-FPM to syslog instead of it's own logging.

; Error log file ; If it's set to "syslog", log is sent to syslogd instead of being written ; in a local file. ; Note: the default prefix is /var ; Default Value: log/php-fpm.log

error_log = syslog

; syslog_facility is used to specify what type of program is logging the ; message. This lets syslogd specify that messages from different facilities ; will be handled differently. ; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) ; Default Value: daemon

syslog.facility = daemon

; syslog_ident is prepended to every message. If you have multiple FPM ; instances running on the same server, you can change the default value ; which must suit common needs. ; Default Value: php-fpm

syslog.ident = php-fpm