Temporarily enable PHP warnings

 

Overview

This article explains how to temporarily enable PHP warnings so they display in the panel or on a website.

Background

PHP warnings and deprecated notices are hidden by default, so error logs only show critical errors. However, you can temporarily enable these hidden warnings to allow further troubleshooting of a website.

Understanding the messages displayed

The following table provides information on error messages that appear after you enable PHP warnings.

DreamHost recommends upgrading to PHP 7.4+ to benefit from better error handling and visibility.

PHP version Default errors displayed Messages displayed after enabling PHP warnings
7.4+ PHP Fatal Errors
  • PHP Deprecated
  • Notices
  • Strict messages
  • Warnings
7.3 or lower None
  • PHP Fatal Errors
  • PHP Deprecated
  • Notices
  • Strict messages
  • Warnings

Enabling PHP warnings

There are two ways to view PHP warnings.

  • In the panel (read from your website's error.log file)
  • Displayed on your website

Option 1 — Enable in the panel

This option temporarily enables PHP warnings in a website's error.log file. These errors can then be viewed in the panel.

  1. Navigate to the Manage Websites page.
  2. Click the Manage button to open Website settings, which allows you to modify various configurations for your site.
    • If in Grid view, click the Manage button at the bottom of the website box.
    • If in List view, click the Manage button at the far right of your domain name.
  3. Click the Settings tab.
  4. On the Web Options row, click the Modify button.
  5. Click the toggle to the right of Temporarily Enable PHP Warnings to enable.

PHP warnings are visible for a period of 7 days and are then disabled automatically.

Option 2 — Enable on your website

This option displays the warnings on your site instead of in the panel. Add the following line to your phprc file using an FTP client or SSH:

display_errors = on

If any PHP errors are thrown, they will now display on your site.

Live websites

This is not recommended on a live website since visitors will see the errors.

See also

Did this article answer your questions?

Still not finding what you're looking for?