diff --git a/scripts/install_php.sh b/scripts/install_php.sh index b5f6c14..a6ccaaa 100755 --- a/scripts/install_php.sh +++ b/scripts/install_php.sh @@ -223,12 +223,11 @@ function install_php() { run mkdir -p "/home/${LEMPER_USERNAME}/logs/php" fi - # Log rotation. - run cp -f "etc/logrotate.d/php${PHPv}-fpm" /etc/logrotate.d/ && \ - run chmod 0644 "/etc/logrotate.d/php${PHPv}-fpm" - # Optimize PHP & FPM configuration. optimize_php_fpm "${PHPv}" + + # Log rotation. + add_php_logrotate "${PHPv}" fi } @@ -516,6 +515,33 @@ EOL # /etc/php/${PHPv}/fpm/pool.d/${POOLNAME}.conf } +function add_php_logrotate() { + # PHP version. + local PHPv="${1}" + if [[ -z "${PHPv}" ]]; then + PHPv=${DEFAULT_PHP_VERSION:-"8.0"} + fi + + run touch "/etc/logrotate.d/php${PHPv}-fpm" + cat >> "/etc/logrotate.d/php${PHPv}-fpm" <