Technical errors should never print on a live page. Ask your developer or host to switch error display off, send errors to a private log, and show visitors a plain apology page with your phone number.

Code where the catalogue should be

A building supply store's website lists lumber, fasteners, paint and tools. Most days the product pages work. Some days a page shows a block of grey technical text where the catalogue should be.

The text names a file deep inside the server, the database the site uses, and the exact request that failed. Anyone who opens the page can read it, and Google has indexed some of it.

A customer looking for deck screws sees a broken page. Someone looking for a way into the site sees a set of directions.

What the message gives away

A technical error message is written for the developer who built the site. On a live page, it tells strangers the same things:

None of this is a password. Together it is a map, telling an attacker what the site runs on, which weaknesses to try first and where things are kept.

How strangers find these pages

Pages that print errors are usually served as if nothing were wrong, so Google indexes the error text as the page's content and may show it in search results.

People probing for weak sites search for the wording of common error messages and get a list of sites showing them.

Google may keep showing the text for a while after the page is fixed, until it next visits.

Errors also appear when someone tests a site by feeding odd characters into its addresses or forms. A detailed message tells them at once whether the test found something.

Where the setting lives

Whether errors appear on screen is a setting. It sits in the server's PHP configuration, in the site's own configuration file, or in the content management system's settings.

WordPress, Joomla and Drupal each have a debugging or error reporting option. Developers switch it on while building and testing, and it is meant to be switched off when the site goes live.

On some shared hosting, errors display by default until someone changes it. Either way, the developer or host controls the setting.

Errors belong in a private log

The details in an error message are useful, just not to visitors. The same information can be written to a log file outside the public folders, with the time and the page that failed.

Your developer reads the log, sees which errors repeat, and fixes their causes. Visitors never see it, and neither does Google.

A log that is never opened only moves the problem out of sight. Agree who reads it and how often, monthly at the least.

What visitors should see instead

When a page cannot be produced, visitors should see a short apology in the site's own design, with the phone number, the hours and a link back to the catalogue.

That page should also send the status code that tells browsers and Google the problem is temporary. Google then keeps its earlier copy and returns later, instead of indexing the apology as the page.

Keep the apology free of technical words. A visitor who reads that a database connection failed learns nothing useful, and an attacker learns a little.

A worked example

A pool table dealer in Prince George sells tables, cues, cloth and lighting from a showroom, with an online catalogue built several years ago on PHP and a database.

A customer emailed a screenshot of a table's page showing a database error, asking whether the store had closed. A search for the store's name showed the same error text as a result's description.

The developer found two problems. Error display had been left on since the catalogue was built, and pages for discontinued tables were still linked but asked the database for products that no longer existed.

Error display was switched off on the live site, and errors now go to a private log. A plain error page gives the showroom's number and a link to the current tables.

Pages for discontinued tables now say the model is no longer available and point to similar ones. The developer then asked Google to crawl the affected pages again through Fetch as Google in Webmaster Tools.

Visitors who hit a problem now get a page that tells them what to do next, and the details that once filled the screen go to the one person who can use them.

Fixing the cause, not just the message

Hiding an error does not fix it. A page that fails now and then may point to a struggling database, an unfinished update, or code that no longer suits the server's version of PHP.

Outdated add-ons and themes are a common source, since many were written for earlier versions of the server's software.

Errors that arrive from strange-looking addresses, full of quotation marks and code, suggest someone testing for weaknesses. The log shows them, and the developer should look at what was tried.

The counter-case

On a development copy of the site, protected by a password, showing errors on screen is exactly right. Developers need the detail, and only they can see it.

A small site built from plain pages, with no database and no scripts, rarely produces these messages at all, and some hosts already keep them off.

But no live page seen by the public should print one. Asking the developer or host to confirm the setting takes a single email, whatever the site is built with.

Finding and hiding the messages

  1. Run a Google search limited to your site, adding warning, fatal error or mysql.
  2. Ask your developer or host whether errors display on the live site.
  3. Have errors written to a private log instead.
  4. Add a plain error page with your phone number and a way back.
  5. Check that page tells Google the problem is temporary.
  6. Fix the causes the log shows, most frequent first.
  7. Ask Google to crawl the affected pages again.

Step two settles the matter for the whole site at once. Error display is a single setting, and the person who manages the server or the site can switch it off and confirm it in writing.

Changes to server settings like this one belong with whoever manages the server, made with a copy kept, for the reasons set out in the server settings file that took the whole site down.


Frequently asked questions

Why are technical error messages a security risk?

They show file paths, the database name, the software and the failed query. None is a password, but together they tell an attacker what runs the site and where to look first.

How can I tell if my site shows them?

Run a Google search limited to your site, adding words like warning, fatal error or mysql, and ask your developer or host whether error display is on for the live site.

Where should errors go instead?

To a private log file outside the public folders, where your developer can read the details and fix the cause without visitors or search engines ever seeing them.

What should visitors see when a page fails?

A short apology in the site's own design, with the phone number and a link back to the catalogue, sent with a status that tells Google the problem is temporary.

Will Google keep showing the error text?

Until it visits the page again. Once the page is fixed, Fetch as Google in Webmaster Tools lets you ask for it to be crawled sooner.

Is hiding the errors enough?

No. Errors usually point to something that needs fixing, such as a failed update or links to deleted products. Read the log and fix the causes as well.

West Coast Media Solutions Inc. provides web design, web development, hosting, digital marketing, and business consulting to organisations across Canada, drawing on more than twenty-five years in the field.

Strange technical text on your product pages?

Send us the address of a page that shows it, and we will arrange a private log and a proper error page.

Start a Conversation