Skip to content
Security

Debug Mode in Production: Checking Profiler and Error Pages

After a hotfix, debug mode often stays on. What strangers see on error pages and in the profiler, and how to check Shopware and WordPress after each change.

19 min read SicherheitsupdatesShopwareWordPressKonfiguration

In short and in plain language

A shop has a mode for finding errors. It is called debug mode. When an error happens, it shows a lot of detail.

No customer should see this detail. It shows names of files and parts of the code. An attacker can use it to find weak spots.

Sometimes the mode is turned on fast when something breaks. Then it stays on by mistake. In normal use you hardly notice it.

So you check from outside after each change. You open a page that does not exist. The page must not show any code.

To find errors, the log on the server is mostly enough. No customer sees the log.

The sales week is running, an error appears in the checkout, and debug mode gets switched on to find the cause. The hotfix is out within an hour, the switch stays where it is. From that moment on, the next failure shows every visitor a detailed error page with file paths and a stack trace, possibly along with a profiler toolbar that also leads to other people's requests. Misconfiguration ranks number 2 in the OWASP Top 10:2025, and 100 percent of the applications tested showed some form of it (OWASP Top 10:2025). This article shows which switches control debug mode in Shopware and WordPress, what a stranger sees while it is on, how log levels and disk space are tied to it, and which checklist tells you within minutes after every change whether the shop is back in production mode. Hardening PHP itself is covered in the article on server hardening for online shops; this one is about the application layer above it.

Key takeaways

  • Shopware derives debug mode from APP_ENV: without APP_DEBUG it is on in every environment except prod, and without APP_ENV the shop boots as dev (Shopware source code). Set both values explicitly.
  • Detailed error pages reveal paths, classes and versions. Shopware 6.7.14.0 answers sw-expect-packages on unauthenticated endpoints with 417 because the error message disclosed installed versions (Shopware release notes 6.7.14.0).
  • The Symfony profiler does not belong in production: /_profiler holds the profiles of all requests, and they are only removed probabilistically after 2 days (Symfony documentation).
  • WordPress prints errors into the HTML as soon as WP_DEBUG is on, because WP_DEBUG_DISPLAY defaults to true (WordPress documentation). In production both are false, and any log sits outside the web root.
  • For troubleshooting in production mode the log is usually enough: with fingers_crossed, Shopware writes all messages from level error upward to a rotating file that no visitor gets to see (Shopware source code).
  • After every hotfix, update and server move, run four checks from outside: no X-Debug-Token header, 404 on /_profiler, a forced 404 without stack trace, and no reachable wp-content/debug.log.

Why the switch stays on after the hotfix

Debug mode is a troubleshooting tool, and that is exactly why it gets switched on in exceptional situations. During Black Week every minute in which the checkout fails counts. Anyone who has to look at the live system to see why a payment breaks off reaches for the fastest option: detailed error messages right in the browser. Once the fix is in, the tension is gone, attention moves to the next ticket, and the entry in the configuration file stays as it is. It would only show at the next error, because in normal operation a shop in debug mode looks almost exactly as before.

OWASP files the problem under category A02 Security Misconfiguration. In the Top 10:2025 it ranks number 2, up from number 5 in the previous edition, and 100 percent of the applications tested had some form of misconfiguration (OWASP Top 10:2025). The listed symptoms explicitly include error handling that reveals stack traces or other overly informative error messages to users (OWASP Top 10:2025). Among the weaknesses OWASP maps to the category is CWE-489 Active Debug Code (OWASP Top 10:2025), which MITRE's weakness list describes as a product released with debugging code still enabled or active (MITRE CWE).

The distinction matters because there are two layers. At the PHP level, display_errors decides whether error messages reach visitors; that is covered in the article on server hardening and not repeated here. Above it sits the application. Shopware and WordPress have switches of their own that turn on detailed error pages, debug toolbars and extra logging. A server with properly hardened PHP can therefore still deliver a shop that gives away internals. The following sections are about these application switches.

What a stranger sees on the error page

In Symfony, the foundation of Shopware, every error is treated as an exception, whether it is a 404 or a fatal error in the code (Symfony documentation). In the development environment the framework catches these exceptions and shows its own error page with a lot of detail about the cause. In production it does not show these pages, because they contain a lot of sensitive internal information, and serves a minimal, generic error page instead (Symfony documentation). For checking, this means a mistyped address is enough to see one page or the other. An attacker does not need a real fault in the shop, just an address that does not exist.

Part of the debug pageWhat it revealsWhat an attacker uses it for
Exception class and messageWhich library failed at which point, often with parts of the requestTargeted input that triggers the same error again
Stack traceCall chain with classes, methods and extensions down to the database driverA list of the plugins in use and their code paths
File pathsInstallation directory and server layoutLocal knowledge for follow-up attacks, for example when planting files
VersionsFramework and PHP version in the profiler toolbarMatching against known vulnerabilities of exactly these versions
ProfilerRequest, log, routing, cache and, in Shopware, the cartInsight into other visitors' requests via /_profiler

OWASP describes exactly this case as an attack scenario: the application server's configuration allows detailed error messages such as stack traces to be returned to users, potentially exposing sensitive information or underlying flaws such as component versions that are known to be vulnerable (OWASP Top 10:2025). MITRE's weakness list files this as CWE-209, an error message that includes sensitive information about its environment, users or associated data (MITRE CWE). Even the Symfony documentation advises against printing the stack trace in a custom error template for end users, because the trace contains sensitive data (Symfony documentation).

Current case: Shopware 6.7.14.0

How seriously even version details in error messages are taken shows in a change in Shopware 6.7.14.0 (Shopware release notes 6.7.14.0): the sw-expect-packages header is no longer evaluated on endpoints that do not require authentication, because the failure messages disclosed the installed versions of Shopware and its dependencies. Sending it there now returns status 417 with a new error code instead of evaluating the constraint (Shopware release notes 6.7.14.0). A shop in debug mode hands out comparable details through other channels, via the profiler toolbar and the paths in the stack trace.

Shopware: APP_ENV and APP_DEBUG

Shopware is built on Symfony and inherits its environments. A typical Symfony application begins with three environments: dev for local development, prod for production servers and test for automated tests (Symfony documentation). Which one applies is decided by the APP_ENV variable, whose default the Shopware documentation gives as prod (Shopware documentation). Next to it sits APP_DEBUG, which controls debug mode. They are separate switches but linked, and that link is where the trap lies.

That default only applies if the value actually arrives: the entry point public/index.php of the Shopware project template sets the environment to dev when APP_ENV does not arrive at all (Shopware source code). It switches debug mode on whenever APP_DEBUG is missing and the environment is not called prod (Shopware source code). Symfony itself also configures APP_DEBUG according to the current environment when loading the env files (Symfony source code). That leads to three cases in which a live system runs in debug mode without anyone noticing:

  • Custom environment: anyone who sets APP_ENV=staging or a similar name for a server gets debug mode unless APP_DEBUG=0 is set explicitly, because only prod counts as a production environment.
  • Missing entry: if the variable is missing from every source, for example because the .env did not come along when moving into a container and the container does not set it, the shop boots as dev.
  • Configuration copied back from testing: a .env.local from the test environment that lands on the live system after a hotfix brings APP_ENV=dev along with it.

Two more rules explain why looking at the file alone is not enough. Real environment variables always win over values from .env files (Symfony documentation). If APP_ENV=dev is set in the web server or container configuration, correcting .env.local does nothing. And once composer dump-env prod or bin/console dotenv:dump has created a .env.local.php, Symfony only loads that file and no longer parses the .env files (Symfony documentation). Switching .env.local back to prod then changes nothing until the file is regenerated. The Shopware documentation lists this dumped file as the recommendation for production (Shopware documentation), so it may well exist on a live system.

Check APP_ENV and APP_DEBUG on the server
cd /var/www/shop

# 1. What do the env files say?
grep -H -E '^(APP_ENV|APP_DEBUG)=' .env .env.local 2>/dev/null

# 2. Is there a dumped file? Then it applies instead of the .env files.
test -f .env.local.php && php -r '$e = include ".env.local.php"; printf("APP_ENV=%s APP_DEBUG=%s\n", $e["APP_ENV"] ?? "-", $e["APP_DEBUG"] ?? "-");'

# 3. Do the web server or PHP-FPM set their own values? They take precedence.
grep -R -n -E 'APP_ENV|APP_DEBUG' /etc/php/*/fpm/pool.d/ /etc/nginx/ /etc/apache2/ 2>/dev/null

# 4. Is the profiler's development package installed?
composer show symfony/web-profiler-bundle >/dev/null 2>&1 && echo "WARNING: profiler package installed"

The fourth command leads to the next section. The profiler only appears in the shop if its package is installed and the environment is dev. Both together are rarely a coincidence; they are usually the result of a deployment that installed development dependencies and started with the wrong environment.

The profiler toolbar and /_profiler

Never enable the profiler in production environments as it will lead to major security vulnerabilities in your project.

Symfony documentation, Profiler

The profiler uses so-called data collectors to gather information about the request, the logger, the routing, the cache and more (Symfony documentation). Shopware has extended the scope: since version 6.7.2.0 the cart data is visible in the profiler as well (Shopware release notes 6.7.2.0). Symfony injects the debug toolbar at the bottom of the page, and the /_profiler address lets you browse all stored profiles (Symfony documentation). In production that means anyone who knows the address sees other visitors' requests, including what they put in their cart.

The profiler gives itself away even without a visible toolbar. It assigns a token to every stored request and sends it in the X-Debug-Token header (Symfony documentation). For responses without HTML, such as JSON from an API, the link to the profile is in X-Debug-Token-Link (Symfony documentation). These headers are the simplest marker to check from outside, because they also appear in responses where no toolbar is rendered.

Then there is disk space. Profiles are stored as files in the application's cache directory and are only removed probabilistically after 2 days (Symfony documentation). During a sales week with heavy traffic this pile grows quickly. In dev mode Shopware also keeps many objects in memory for debugging purposes, which leads to high memory usage (Shopware documentation). Under peak load, a shop in debug mode is therefore not only more exposed but also slower and more prone to full disks; how to keep an eye on usage is shown in the article on disk space monitoring.

How the profiler ends up on a live system is easy to trace. It is installed as a development package (composer require --dev), and the Shopware documentation explicitly lists the Symfony profiler as a tool available only in development mode (Shopware documentation). Running composer install on the server without the --no-dev flag pulls the development packages onto the system anyway; the Symfony documentation describes --no-dev as the flag that ensures development packages are not installed in production (Symfony documentation). If APP_ENV=dev is also set, the toolbar is there.

WordPress: WP_DEBUG and WP_DEBUG_DISPLAY

In WordPress the central switch is called WP_DEBUG. The constant lives in wp-config.php, is false without an entry and is usually turned on for development copies (WordPress documentation). The documentation explicitly advises against using WP_DEBUG or the other debug tools on live sites; they are meant for local testing and staging installs (WordPress documentation).

The trap lies in the companion constants. WP_DEBUG_DISPLAY controls whether debug messages appear in the HTML of the page, and its default is true (WordPress documentation). So anyone who only sets WP_DEBUG to true to find an error shows the messages to every visitor. WordPress sets display_errors to 1 at runtime to do this (WordPress source code), which overrides the server's PHP setting for this site unless the host has locked it. WP_DEBUG_LOG additionally writes the messages to a file, wp-content/debug.log by default (WordPress documentation), which is a directory the web server also serves images and stylesheets from.

A second, less known source is the environment type. WP_ENVIRONMENT_TYPE has four possible values: local, development, staging and production; if it is not set, production applies (WordPress developer reference). If the type is development and WP_DEBUG is not defined in wp-config.php, WordPress sets WP_DEBUG to true (WordPress developer reference). A staging copy that is pushed back to the live system with development as its type therefore switches on debug mode without WP_DEBUG appearing anywhere.

WordPress checks part of this itself. Site Health in the admin reports when the site displays errors to visitors, and for WP_DEBUG_LOG it warns that errors are written to a file which is potentially available to all users (WordPress source code). If the log sits inside the WordPress directory, the test rates this as critical (WordPress source code). A look at Site Health therefore belongs in every check after a change.

wp-config.php in production
// Production: no output, no public log
define( 'WP_ENVIRONMENT_TYPE', 'production' );
define( 'WP_DEBUG', false );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', false );
define( 'SCRIPT_DEBUG', false );
define( 'SAVEQUERIES', false );

// Short diagnosis with an end date: log only, log file outside the web root
// define( 'WP_DEBUG', true );
// define( 'WP_DEBUG_DISPLAY', false );
// define( 'WP_DEBUG_LOG', '/var/log/shop/wp-debug.log' );

SAVEQUERIES belongs on false as well: the constant saves every database query with its execution time and calling function, and the documentation points out the performance impact (WordPress documentation). You are free to choose the path for WP_DEBUG_LOG; the documentation explicitly provides for a valid file path elsewhere (WordPress documentation). How we look after WordPress installations in ongoing operation is described on the WordPress maintenance page.

Log levels and disk space

Debug mode and logging are closely linked. PSR-3, the common logger interface in PHP, defines eight levels from debug through info, notice, warning, error, critical and alert to emergency (PSR-3). The Symfony documentation describes the purpose of the environments like this: while developing you want to log everything, and in production the same application should be optimized for speed and only log errors (Symfony documentation). Anyone who lowers the level to debug for a hotfix, or switches the whole environment to dev, records every detail from then on.

In Shopware the difference is built into the shipped configuration. For prod the core uses the fingers_crossed handler with action level error and writes from level error upward to a rotating file; for dev it writes all messages from level debug upward, except the event and doctrine channels, as a plain stream into one file (Shopware source code). A shop that keeps running in dev after the hotfix therefore fills a single, unsplit log file with almost everything every request produces.

For operations Shopware recommends setting the Monolog level to error to reduce the number of logged events, and limiting buffer_size so that long-running background jobs do not cause memory overflows; the documentation's example uses 30 (Shopware documentation). For the business_event_handler_buffer handler this has a side effect worth knowing: at level error, successful flow activities are no longer logged (Shopware documentation). Anyone who needs flows as evidence should decide this deliberately instead of inheriting it from the general level.

Over time log files can grow huge, both while developing and in production; Symfony points to rotation with logrotate or the rotating_file handler (Symfony documentation). A wrong level therefore often shows up first as a disk alert. Which logs are worth monitoring and how to turn them into useful alerts is covered in the article on log monitoring and alerting; how long IP addresses may stay in server logs is covered in the article on server log retention.

SettingDevelopment or diagnosisProduction
Shopware APP_ENVdevprod
Shopware APP_DEBUGonoff, set explicitly to 0
Profiler packageinstalled as a development packagenot installed (composer install --no-dev)
Monolog leveldebugerror, with a limited buffer_size
WordPress WP_DEBUGtruefalse
WordPress WP_DEBUG_DISPLAYtrue (default)false
WordPress WP_DEBUG_LOGfile outside the web rootfalse or a file outside the web root
WP_ENVIRONMENT_TYPEdevelopment or localproduction

The checklist after every change

The most important rule is simple: check from outside, the way a visitor sees the shop. Looking at the configuration file is useful but proves little, because server environment variables, dumped .env.local.php files and caches sit in between. The check belongs after every hotfix, every update, every server move and every push back from a staging environment.

  • Response headers: the home page sends no X-Debug-Token or X-Debug-Token-Link header.
  • Profiler address: /_profiler answers with 404, not with a list of profiles.
  • Error page: a forced 404 on a made-up address shows the shop's normal error page, without file paths, class names or stack trace.
  • Debug toolbar: no toolbar appears at the bottom of the storefront, not on checkout or the customer account either.
  • WordPress log: wp-content/debug.log cannot be retrieved, and Site Health reports no debug finding.
  • Server side: APP_ENV=prod and APP_DEBUG=0 are set in the source that actually applies, and the profiler package is not installed.
  • Log level and disk: log files do not grow faster after the change than before.
  • Record: date, change, the person who checked and the result are in the maintenance log.

The first five items can be checked from outside with no server access. The following script covers items one to three and five; for the toolbar in item four, a look in the browser is enough. It expects the shop's address and only reports deviations; a run without output and exit code 0 means passed. If you run it regularly, write its output to a log file so that a persistent fault leaves a trace too.

debug-check.sh
#!/bin/bash
# Checks from outside whether a shop serves debug traces.
# Usage: ./debug-check.sh https://shop.example
SHOP="${1:?Provide the shop address}"
RC=0

# 1. Profiler headers in the home page response
if curl -sSI "$SHOP/" | grep -qi '^x-debug-token'; then
  echo "DEVIATION: X-Debug-Token in the response"; RC=1
fi

# 2. Profiler interface reachable?
code=$(curl -s -o /dev/null -w '%{http_code}' "$SHOP/_profiler/")
if [ "$code" != "404" ]; then
  echo "DEVIATION: /_profiler answers with $code"; RC=1
fi

# 3. Forced 404 on a made-up address
hits=$(curl -s "$SHOP/debug-check-$(date +%s)-404" \
  | grep -Eic 'stack ?trace|symfony\\component|\.php \(line [0-9]+\)|\.php on line [0-9]+')
if [ "$hits" -gt 0 ]; then
  echo "DEVIATION: error page shows $hits debug markers"; RC=1
fi

# 4. WordPress debug log publicly reachable?
code=$(curl -s -o /dev/null -w '%{http_code}' "$SHOP/wp-content/debug.log")
if [ "$code" = "200" ]; then
  echo "DEVIATION: wp-content/debug.log is reachable"; RC=1
fi

exit $RC

The made-up address works for Shopware because Symfony treats a 404 as an exception as well and renders the detailed page in debug mode (Symfony documentation). In WordPress a 404 does not necessarily trigger a PHP message; there, Site Health in the admin complements the check from outside. If /_profiler answers with a code other than 404, for example because a firewall sits in front, check the case by hand instead of dismissing the report.

Alert on deviation

A checklist that only runs after planned changes misses changes nobody knows about: a late-night test on the live system, a PHP-FPM pool newly created by the hosting provider, a restored backup with an old configuration. OWASP recommends an automated process to verify the effectiveness of configurations and settings in all environments; where that is not automated, it should be verified manually annually at a minimum (OWASP Top 10:2025). For a shop in peak season a year is too long. The check script can run as a cron job daily or hourly, its output belongs in a log file and any deviation in the on-call alert channel, whose response times are set out in an SLA maintenance contract.

If you already run external monitoring, add a content check there: if a debug marker shows up in the response body of the home page or a known error page, treat it like an outage. How we monitor shops from outside is described on the monitoring page. The built-in Shopware system check does not replace this check: none of the checks shipped with version 6.7.16.0 asks whether APP_ENV is prod or APP_DEBUG is 0 (Shopware source code).

An alert needs a clear owner. Whoever switches debug mode on enters an end date, and whoever receives the alert may switch it back without first having to find the person responsible. During Black Week the change freeze applies as well: a debug switch is a change to the live system and needs the same approval as any other update.

Troubleshooting without debug mode

The most common objection is that you cannot find the error without debug mode. For Shopware that is usually not true. The fingers_crossed handler, which Symfony uses in production by default, stores all log messages during a request and only passes them to a second handler once one of them reaches the configured level (Symfony documentation). Shopware uses this handler with action level error but also lets the second handler write only from error upward (Shopware source code). An uncaught exception that breaks a checkout therefore usually ends up in the log without any visitor seeing it; messages below error from the same request are missing there, though.

For the rest there are controlled routes. The first is to reproduce the error on a staging copy with the same data; debug mode may run there as long as the copy is not publicly reachable. How to find forgotten copies is covered in the article on forgotten test sites and stale subdomains. If it has to happen on the live system, log instead of display: in WordPress, WP_DEBUG_LOG with a path outside the web root and WP_DEBUG_DISPLAY set to false; in Shopware, a temporarily lower log level instead of APP_ENV=dev. Both with an end date, a responsible person and the check script afterwards.

If a checkout failure stays unclear despite the log, that is a case for emergency support with access to logs and staging, not for a debug switch during live sales. How we maintain configuration and patches in ongoing operation is described on the pages on security updates and Shopware maintenance.

Sources

This article is based on data from: OWASP Top 10:2025, category A02 Security Misconfiguration (owasp.org); MITRE CWE, entries CWE-209 and CWE-489 (cwe.mitre.org); Symfony documentation, pages Profiler, Configuration, How to Customize Error Pages, Logging and How to Deploy a Symfony Application (symfony.com); Symfony source code, Dotenv component in version 7.4 (GitHub); Shopware documentation, pages Environment Variables, Performance Tweaks, Troubleshooting and Understanding Your Shopware Project (developer.shopware.com); Shopware release notes 6.7.2.0 and 6.7.14.0 (developer.shopware.com); Shopware source code, project template public/index.php, Monolog configuration and system checks (GitHub); WordPress documentation, Debugging in WordPress (developer.wordpress.org); WordPress developer reference, wp_get_environment_type (developer.wordpress.org); WordPress source code, wp_debug_mode and Site Health (GitHub); PSR-3 Logger Interface (php-fig.org). All sources accessed on November 4, 2026.

Related Articles

Maintenance & updates

Abandoned plugins: spotting extensions that stopped updating

How to spot abandoned plugins and extensions in your shop, why a maintenance status belongs in the inventory and when to replace, take over or remove them.

20 min read
Maintenance & updates

Node.js in the shop build: 20 is out, 22 ends in 2027

Shopware 6.7 lists Node.js 20 as its minimum, yet that line lost support in April 2026. Where Node sits in the shop build and how to move to 24 safely.

18 min read
Maintenance & updates

Composer blocks the update: resolving the security block

Composer blocks the update over a security advisory? How to read the message, find the dependency path, move to the patched version and set dated exceptions.

17 min read