PHP error guide

Xdebug log permission denied: meaning and fix

Error summary

Choose a private writable log path and set restrictive ownership. The PHP worker identity cannot create or append the configured Xdebug log.

What it means

Choose a private writable log path and set restrictive ownership. The PHP worker identity cannot create or append the configured Xdebug log.

What the error means

This message means that the PHP worker identity cannot create or append the configured Xdebug log. The exact signature distinguishes xdebug log permission denied from a generic application failure.

Why PHP produces it

The engine or service reports “Xdebug log permission denied” because its required precondition was not met. Choose a private writable log path and set restrictive ownership.

PHP version notes

The xdebug log permission denied wording here is based on Xdebug 3.x except the nesting-level legacy page; 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 PHP worker identity cannot create or append the configured Xdebug log
  • The code path assumes the prerequisite for xdebug log permission denied has already been satisfied.
  • For xdebug log 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 xdebug log permission denied.

Minimal examples

BAD — reproduces the problem

ini
xdebug.log=/root/xdebug.log

FIXED — safer pattern

ini
xdebug.log=/var/log/php/xdebug.log

Step-by-step diagnosis

  1. Copy the complete “Xdebug: [Log Files] File '/var/log/xdebug.log' could not be opened.” text and retain the first application stack frame.
  2. Reproduce xdebug log permission denied in the same SAPI and environment listed for this page.
  3. Before changing xdebug log permission denied, inspect the preceding value or directive and verify its type, path, version, and permissions.
  4. Apply the narrow correction—choose a private writable log path and set restrictive ownership—then repeat the original request once.

Fixes

Correct the failing prerequisite

Choose a private writable log path and set restrictive ownership

ini
xdebug.log=/var/log/php/xdebug.log

Fail explicitly at the boundary

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

Common mistakes when fixing it

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

How to prevent it

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

Web server / environment notes

fpm, cli, docker, linux. The failure occurs where the PHP worker identity cannot create or append the configured Xdebug log

Tags: fpm,cli,docker,linux

Categories