Skip to content
FunnelGuard

Fix guide by FunnelsGuard

PHP warnings showing on your website: how to hide and fix them

OPS-084Medium impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

PHP is the language that runs WordPress, WooCommerce and many custom sites. When it hits something odd, it raises a notice, a warning or an error. The setting display_errors decides whether that message is printed into the page HTML. On a live site it should be off.

You usually see it as text like Warning: Undefined variable $total in /home/site/public_html/wp-content/themes/shop/cart.php on line 42 sitting above your header, inside a form or in the middle of a product page. It also leaks file paths, which helps attackers.

Why it costs you leads or sales

Raw error text makes a site look broken and untrustworthy, especially next to a form or a checkout button. It can push layouts out of place, hide a button or break a form's styling. Warnings printed before headers are sent can also stop redirects and cookies from working, which can break thank-you pages and tracking.

Output printed into a JSON or AJAX response (for example a form submit) can corrupt it, so the form looks like it failed even when it worked. It also exposes server paths and plugin names.

How a visible warning can cost a lead
  1. Visitor opens pagePage loads
  2. PHP raises warningdisplay_errors is On
  3. Layout or form breaksText shown, headers already sent
  4. Form submit or redirectFails or looks untrustworthy

A warning printed before headers are sent can break the step after it.

A PHP warning appears on a live page

The visitor sees technical text instead of your offer.

How to check if your site has it

Quick checks
  • Open your key pages (home, landing pages, contact, cart, checkout) and look for text starting with Warning:, Notice:, Deprecated: or Fatal error:.
  • View page source and search for Warning: and on line.
  • Look at the top of the page, inside forms and near the footer, where output often lands.
  • Check the same pages while logged out and on mobile.
  • In WordPress, check whether WP_DEBUG_DISPLAY is true in wp-config.php.
  • Ask your host or run phpinfo() once (then delete the file) to see the value of display_errors.
Search a page's HTML for visible PHP messagesbash
curl -s https://example.com/ | grep -iE "(Warning|Notice|Deprecated|Fatal error):.* on line [0-9]+"

How to fix it

Hide errors from visitors, then fix the cause
  1. Turn display off and logging on

    Set display_errors to Off and log_errors to On using the method for your platform below.

  2. Read the log

    Find the error log (often error_log in the site folder, or in your host's control panel under Logs). Note the file and line of each warning.

  3. Fix the source

    Update the plugin, theme or custom code named in the message. Common causes are undefined variables, missing array keys and deprecated functions after a PHP upgrade.

  4. Reload and retest

    Clear caches and reload the pages that showed the message.

Turn off error display by platform
  1. Edit wp-config.php

    Set define('WP_DEBUG', false); or, to keep logging, define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false); and @ini_set('display_errors', 0); above the line 'That's all, stop editing'.

  2. Update plugins and theme

    Warnings often come from outdated plugins. Update them, or contact the author with the log line.

Recommended production settings (php.ini)text
display_errors = Off
log_errors = On
error_reporting = E_ALL
error_log = /path/to/php-error.log

How to confirm it's fixed

Confirmation
  • Reload the affected pages in a private window: no Warning, Notice or Deprecated text.
  • The curl search above returns nothing.
  • New entries appear in the error log instead of on the page.
  • Submit your contact form and run through checkout up to payment to confirm they still work.

How to prevent it happening again

Keep development and production settings separate: display on in staging, off in production. Test plugin and PHP updates on staging first. Review the error log regularly, and re-check key pages after any update, host change or PHP version change.

How FunnelGuard handles this

FunnelGuard covers this partly. If you configure it, a journey step can check that certain error text is absent from a page (a text_absent check), for example Warning: or Fatal error. If that text shows up on a page the robot visits, the check fails, is re-checked from a second region, and you get one alert with a screenshot and a likely cause.

If you see full stack traces rather than short warnings, that is debug mode (a related issue). If warnings started after a PHP upgrade, check plugin compatibility.

Questions people ask

Why is my website showing PHP warnings to visitors?

Because the PHP setting display_errors is on, so PHP prints warnings and notices into the page. It is often left on from development, or turned on by WP_DEBUG in WordPress. Turn it off and log errors instead.

How do I turn off PHP errors on my website?

Set display_errors = Off in php.ini, .user.ini or your host's PHP settings. In WordPress, set WP_DEBUG_DISPLAY to false in wp-config.php. Keep log_errors on so you can still read the problems.

Are PHP warnings dangerous for my site?

They are rarely fatal, but they leak file paths and plugin names, can break layouts and can interfere with redirects and form responses. They also signal code that may fail later.

Will hiding PHP warnings fix the problem?

No. It only hides the message from visitors. The faulty code still runs, so read the log and fix or update the plugin, theme or script that causes it.

Why do I see PHP notices after updating PHP?

A newer PHP version is stricter and flags deprecated functions and undefined variables that older versions ignored. Update the plugins and theme named in the message, or ask their authors for a compatible version.

Where do I find the PHP error log?

Check your host's control panel under Logs or Errors, or look for an error_log file in your site folder. In WordPress with WP_DEBUG_LOG on, look for wp-content/debug.log.

Can FunnelGuard detect PHP warnings on my site?

Partly. If configured, it can check that error text like Warning: is absent on the pages your journeys visit and alert you if it appears. It does not read PHP settings or logs, so check those by hand.

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.