Skip to main content

WordPress PHP errors live, instead of reading debug.log

Install the WP Sentry plugin and add a few lines to wp-config.php that point it at http://sentry@127.0.0.1:8000/1. PHP warnings and fatal errors from your local WordPress site then show up live in Buggregator, each with its stack trace and request. You see them as they happen, without opening wp-content/debug.log.

Steps

1. Start Buggregator

bash
docker run --pull always \
  -p 127.0.0.1:8000:8000 \
  ghcr.io/buggregator/server:latest

2. Install WP Sentry

Install the WP Sentry plugin. You do not need to activate it: wp-config.php loads it directly.

3. Add the lines to wp-config.php

WP_ENVIRONMENT_TYPE must be local, so the lines never run on production. Local sets it by default.

php
if (defined('WP_ENVIRONMENT_TYPE') && 'local' === WP_ENVIRONMENT_TYPE) {
	define( 'WP_SENTRY_PHP_DSN', 'http://sentry@127.0.0.1:8000/1' );
	define( 'WP_SENTRY_ERROR_TYPES', E_ALL & ~E_NOTICE & ~E_USER_NOTICE );
	require_once __DIR__ . '/wp-content/plugins/wp-sentry-integration/wp-sentry.php';
}

WP_SENTRY_ERROR_TYPES picks which PHP errors are sent: here everything except notices.

4. Load a page and look

Open your site, then http://127.0.0.1:8000. Each error shows the stack trace frame by frame with the code around each line, the request, the breadcrumbs before it, tags and loaded packages. New errors appear as they happen.

Why it works

WP Sentry wraps the Sentry PHP SDK. The SDK catches PHP errors and exceptions and sends them over HTTP to the address in the DSN. Buggregator speaks the same protocol on port 8000, so it stores each error and shows it in the UI right away.

Checked on with Buggregator v2.13.0

Setup in 60 seconds

No registration. No account. Start it and point your app at it.

1

Start Buggregator

One file, installed with one command. The web UI opens on port 8000. Prefer containers? Use the Docker tab.

$ curl -fsSL https://raw.githubusercontent.com/buggregator/server/master/scripts/install.sh | sh
$ HTTP_ADDR=127.0.0.1:8000 \
  SMTP_ADDR=127.0.0.1:1025 \
  VAR_DUMPER_ADDR=127.0.0.1:9912 \
  MONOLOG_ADDR=127.0.0.1:9913 \
  PROXY_ADDR=127.0.0.1:8080 \
  ~/.local/bin/buggregator

The script picks the file for your CPU: Intel/AMD or ARM.

One file for Linux, macOS and Windows, about 40 MB. Nothing else to install.

This run line keeps it on this computer. Without the *_ADDR settings it listens on all network interfaces

Rather not run a script? Download the file yourself

Runs on Windows, macOS and Linux, on Intel/AMD and ARM.

Prefer not to do it yourself? Your AI agent can set Buggregator up for you