PHP error guide

PHP-FPM slowlog permission denied: meaning and fix

Error summary

Create the log path with ownership and SELinux context appropriate to FPM. The pool cannot create or write its configured slow-request log.

What it means

Create the log path with ownership and SELinux context appropriate to FPM. The pool cannot create or write its configured slow-request log.

What the error means

This message means that the pool cannot create or write its configured slow-request log. The exact signature distinguishes php-fpm slowlog permission denied from a generic application failure.

Why PHP produces it

The engine or service reports “PHP-FPM slowlog permission denied” because its required precondition was not met. Create the log path with ownership and SELinux context appropriate to FPM.

PHP version notes

The php-fpm slowlog permission denied wording here is based on Current PHP-FPM, Apache 2.4, or nginx; punctuation and exception class names can differ on older branches or vendor builds.

Most common causes

  • The immediate input or configuration reaches the specific condition: the pool cannot create or write its configured slow-request log
  • The code path assumes the prerequisite for php-fpm slowlog permission denied has already been satisfied.
  • For php-fpm slowlog permission denied, development and production differ in version, extension, permissions, paths, or service configuration.
  • An earlier operation returned an unchecked value that is consumed by the line reporting php-fpm slowlog permission denied.

Minimal examples

BAD — reproduces the problem

ini
slowlog = /root/www-slow.log

FIXED — safer pattern

ini
slowlog = /var/log/php-fpm/www-slow.log

Step-by-step diagnosis

  1. Copy the complete “ERROR: failed to open slowlog (/var/log/php-fpm/www-slow.log): Permission denied” text and retain the first application stack frame.
  2. Reproduce php-fpm slowlog permission denied in the same SAPI and environment listed for this page.
  3. Before changing php-fpm slowlog permission denied, inspect the preceding value or directive and verify its type, path, version, and permissions.
  4. Apply the narrow correction—create the log path with ownership and SELinux context appropriate to FPM—then repeat the original request once.

Fixes

Correct the failing prerequisite

Create the log path with ownership and SELinux context appropriate to FPM

ini
slowlog = /var/log/php-fpm/www-slow.log

Fail explicitly at the boundary

Validate the condition before the operation that emits php-fpm slowlog permission denied, and log a safe diagnostic without credentials or full production paths.

Common mistakes when fixing it

  • Suppressing php-fpm slowlog permission denied instead of correcting its upstream condition.
  • Testing php-fpm slowlog permission denied only with the CLI binary when the failing request runs under FPM or Apache.
  • Changing a global setting for php-fpm slowlog permission denied before confirming the site-specific effective configuration.

How to prevent it

  • Add a focused test that exercises the boundary responsible for php-fpm slowlog permission denied.
  • Keep runtime versions, extensions, configuration, and deploy artifacts affecting php-fpm slowlog permission denied reproducible.
  • Validate external data and service return values before they can trigger php-fpm slowlog permission denied.

Web server / environment notes

fpm, linux. The failure occurs where the pool cannot create or write its configured slow-request log

Tags: fpm,linux

Categories