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.
- Visitor opens pagePage loads
- PHP raises warningdisplay_errors is On
- Layout or form breaksText shown, headers already sent
- Form submit or redirectFails or looks untrustworthy
A warning printed before headers are sent can break the step after it.
The visitor sees technical text instead of your offer.
How to check if your site has it
- 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:andon 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_DISPLAYis true in wp-config.php. - Ask your host or run
phpinfo()once (then delete the file) to see the value of display_errors.
curl -s https://example.com/ | grep -iE "(Warning|Notice|Deprecated|Fatal error):.* on line [0-9]+"How to fix it
Turn display off and logging on
Set display_errors to Off and log_errors to On using the method for your platform below.
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.
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.
Reload and retest
Clear caches and reload the pages that showed the message.
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'.
Update plugins and theme
Warnings often come from outdated plugins. Update them, or contact the author with the log line.
Edit php.ini
Set display_errors = Off, log_errors = On and error_reporting = E_ALL. Restart PHP-FPM or Apache if you manage the server.
Or use .user.ini / .htaccess
On shared hosting, add display_errors = Off to .user.ini (PHP-FPM) or php_flag display_errors off to .htaccess (Apache mod_php). Which works depends on your host.
display_errors = Off
log_errors = On
error_reporting = E_ALL
error_log = /path/to/php-error.logHow to confirm it's fixed
- 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.
Related guidance
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.
Related issues
- OPS-085Debug mode on in production (stack traces)Fix guide
- OPS-078PHP upgrade breaking plugins/formsFix guide
- OPS-077PHP version end of lifeFix guide
- OPS-073Memory / PHP memory_limit exhausted (white screen)Fix guide
- OPS-075Database connection errors ('Error establishing a database connection')Fix guide
- OPS-072Server out of disk space (uploads, sessions fail)Fix guide