Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Debug mode on in production: how to find and turn it off

OPS-085High impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

Debug mode is a developer setting. It makes software print full technical detail when something fails: the error message, the file and line number, the code path that led there (the stack trace), and often environment values such as database hostnames or API keys. It is useful on your laptop. On a live site it is a problem.

It is usually left on by accident: a staging config copied to production, a quick fix that was never reverted, or a framework default that nobody changed. Common switches include WP_DEBUG in WordPress, APP_DEBUG in Laravel, DEBUG in Django, and NODE_ENV or error handler settings in Node apps.

Why it costs you leads or sales

A visitor who lands on a page full of code does not fill in your form or buy. Trust drops at once. Debug output can also be inserted into the middle of a page, which breaks layout, hides buttons or corrupts form responses and tracking scripts.

There is a security cost too. Stack traces show your folder structure, software versions and sometimes credentials. Attackers use that to plan a break-in, and a hacked or defaced site stops generating leads entirely. Search engines may also index error pages that were shown to them.

How debug output loses a lead
  1. Visitor submits formA minor error occurs on the server
  2. Debug mode shows stack traceFile paths and settings appear on screen
  3. Visitor leavesPage looks broken or unsafe
  4. Lead or saleNever recorded

A small error becomes a visible crash page, and the rest of the journey is lost.

How to check if your site has it

Quick checks
  • Open a URL that does not exist, such as /fg-test-404-page, and see if you get a plain 404 or a technical error page.
  • Look for words like Stack trace, Traceback, Whoops, Exception, Notice, Warning or Fatal error on live pages.
  • View page source and search for file paths such as /var/www/ or wp-content/.
  • Open your config: wp-config.php, .env, settings.py or your host's environment variables.
  • Check response headers for X-Powered-By or debug headers that reveal versions.
  • Search Google for site:yourdomain.com "stack trace" or "Fatal error".
Where the debug switch lives on common stacks
StackSettingSafe production value
WordPressWP_DEBUG, WP_DEBUG_DISPLAY in wp-config.phpWP_DEBUG false
LaravelAPP_DEBUG in .envfalse
DjangoDEBUG in settings.pyFalse
Node/ExpressNODE_ENV and the error handlerproduction
PHP generallydisplay_errors in php.iniOff

How to fix it

Turn debug off safely
  1. Back up first

    Copy the config file you are about to edit so you can roll back.

  2. Switch debug off

    Use the platform instructions below. Make sure errors are hidden from the screen.

  3. Log errors privately

    Keep logging on, but write to a file or a monitoring tool that only you can read.

  4. Clear caches

    Purge page, plugin and CDN caches so no cached error page is still served.

  5. Rotate exposed secrets

    If keys or passwords appeared in an error, replace them.

Turn debug off by platform
  1. Edit wp-config.php

    Set the debug constants to false. Use your host's file manager or SFTP.

  2. Check plugins

    Some debug plugins force display on. Deactivate any you no longer need.

wp-config.php production settingsphp
define( 'WP_DEBUG', false );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', false );
@ini_set( 'display_errors', 0 );
Laravel .env production valuestext
APP_ENV=production
APP_DEBUG=false
What visitors see

Debug on

  • Raw stack trace on screen
  • File paths and versions exposed
  • Forms and scripts can break

Debug off

  • Friendly error page
  • Details kept in a private log
  • Pages render normally

How to confirm it's fixed

Confirmation
  • Reload a non-existent URL and confirm a clean 404 page appears.
  • Trigger a harmless test error in staging, then check production shows no technical text.
  • View source on your key pages and confirm no file paths or error text.
  • Submit your lead form and run a test checkout to confirm they still work.
  • Check your private error log is still collecting entries.

How to prevent it happening again

Keep separate config files or environment variables for staging and production, and never copy one over the other. Add a deploy checklist item for the debug flag. Store the setting in your hosting control panel's environment variables rather than in files that get overwritten. Finally, after every release, load a few key pages and a missing URL to make sure nothing technical shows.

How FunnelGuard handles this

FunnelGuard detects this issue only partly. When you configure it, a journey step can use a text_absent check: it looks at a page the robot visitor loads and fails if given text appears, for example Stack trace, Fatal error or Traceback. If a page on your journey shows that text, you get one alert after a re-check from a second region, with a screenshot and a likely cause.

What it does not do: it does not read your config files, does not know your debug flag value, and does not scan every URL on your site. It only sees the pages in your monitored journeys, and only catches debug output when an error actually happens on them and the text you chose is present. Debug mode that is on but not currently showing an error will pass.

To cover the rest by hand, check your config values after each deploy, request a missing URL and look for technical text, and search Google for your domain plus phrases like Fatal error. A free read-only website audit is also available, and the Free plan includes 1 site and 2 journeys with daily checks.

Questions people ask

Why is my website showing a stack trace?

Debug mode or error display is switched on in production, so the software prints full technical detail when an error occurs. Turn off the debug setting in your config, for example WP_DEBUG, APP_DEBUG or DEBUG, and send errors to a private log instead.

How do I turn off debug mode in WordPress?

Open wp-config.php and set WP_DEBUG and WP_DEBUG_DISPLAY to false. Then clear your caches and check that no plugin is forcing error display on.

Is debug mode on in production a security risk?

Yes. Stack traces reveal file paths, software versions and sometimes credentials, which help attackers plan an attack. Turn it off and rotate any secret that was shown.

How do I turn off APP_DEBUG in Laravel?

Set APP_DEBUG=false and APP_ENV=production in your .env file. Then run php artisan config:clear and php artisan config:cache so the change takes effect.

How can I tell if debug mode is on without access to the server?

Visit a URL that does not exist and look at the page. If you see a stack trace, exception name or file paths instead of a simple 404, debug output is on. Searching Google for your domain plus Fatal error can also reveal indexed error pages.

Will turning off debug mode break my site?

It should not, but Django also needs ALLOWED_HOSTS set once DEBUG is False. Back up your config, make the change, then test your key pages and forms.

Can FunnelGuard tell me if debug mode is on?

Only partly. It can fail a journey step if text such as Stack trace appears on a monitored page when configured. It cannot read your server settings or scan every URL.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: text_absent if configured.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.