PHP-FPM signals for pool error_log rotation

Solution 1:

In addition to the normal signals, PHP-FPM recognizes two 'user-defined' signals: SIGUSR1 and SIGUSR2.

  • SIGUSR1 - will cycle the log files
  • SIGUSR2 - graceful reload of all workers + reload of fpm conf/binary

For log file rotation, SIGUSR1 would be well suited. With specific reference to your scenario, a sample logrotate config is detailed on this page. The signal is passed as follows:

kill -USR1 `cat /path/to/php-fpm.pid`

PHP-FPM signals are defined at: http://php-fpm.org/wiki/Documentation

Solution 2:

Yes, you need to send this signal, but instead of doing it manually, it is better to add the call in follow script:

...
postrotate
    /usr/lib/php5/php5-fpm-reopenlogs
endscript
...