Difference between revisions of "Enabling Error Reporting"

From WHMCS Documentation

m (Disabling from the configuration.php file)
m (PHP Warnings and Notices)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
==Getting Error Information==
 
==Getting Error Information==
The [[Error_Management]] documentation provides a full description of the WHMCS Error Management system and all possible options at your ready. The following sections provide an abridged description of the Display Errors option and overview on how you should consider utilizing it.
+
 
 +
The WHMCS [[Error Management]] system includes many useful options. '''Display Errors''' allows you to view additional information about critical errors.
  
 
===When Should You Enable Display Errors===
 
===When Should You Enable Display Errors===
Display Errors option will often provide additional information when you are experiencing a critical error that is resulting in on of the following:
+
 
 +
'''Display Errors''' provides additional information when you experience a critical error that results in one of the following issues:
 +
 
 
* Friendly "Oops!" pages
 
* Friendly "Oops!" pages
 
* Entirely blank pages
 
* Entirely blank pages
 
* Partially rendered pages
 
* Partially rendered pages
  
In most cases, you will want to use the Log Errors and SQL Debug Mode first, if possible. These options usually will capture the same information that is rendered by the Display Errors option. In the event that these options are not viable or do not yield any information, Display Errors is a good alternative.   
+
In most cases, use the '''Log Errors''' and '''SQL Debug Mode''' options first. These options will usually capture the same information that '''Display Errors''' renders. In the event that these options are not viable or do not yield any information, '''Display Errors''' is a good alternative.   
  
''The Display Errors option is very handy however it will show your error information to anyone who is encountering the same error condition. Showing errors to visitors or non-privileged staff should be avoided when possible.''
+
'''Display Errors''' will show your error information to anyone who is encountering the same error condition. Avoid showing errors to visitors or non-privileged staff whenever possible.''
  
 
===Typical Causes===
 
===Typical Causes===
 +
 
Some of the most common causes of "Oops!", partial, or empty page rendering include:
 
Some of the most common causes of "Oops!", partial, or empty page rendering include:
  
* Missing or corrupted files / incomplete uploads
+
* Missing or corrupted files or incomplete uploads.
* Server not meeting [[System Requirements|minimum system requirements]]
+
* The server doesn't meet the [[System Requirements|minimum system requirements]].
* PHP, Apache or Ioncube related errors
+
* PHP, Apache, or ionCube Loader®-related errors.
* Incompatible hooks or addons
+
* Incompatible hooks or addons.
* Syntax errors in custom modules, hooks or templates
+
* Syntax errors in custom modules, hooks, or templates.
 +
 
 
==Enabling Error Reporting==
 
==Enabling Error Reporting==
 +
 
===Enabling From The Admin Area===
 
===Enabling From The Admin Area===
If the admin area is functioning enough to allow you to navigate to '''General Settings''' follow these steps to enable error display.  Then retry the steps that previously led to the blank or partially rendered page and further error information should be displayed.
 
  
# Navigate to '''Setup > General Settings > Other'''
+
If possible, attempt the following steps to enable '''Display Errors''' via the [[Admin Area]]:
# Tick the '''Display Errors''' checkbox located towards the bottom of the page
+
 
# Click Save Changes
+
# Go to '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[General Settings]]''' or, prior to WHMCS 8.0, '''Setup > General Settings'''.
 +
# Choose the '''[[Other Tab|Other]]''' tab.
 +
# Select '''Display Errors'''.
 +
# Click '''Save Changes'''.
 +
# Retry the steps that previously led to the blank or partially-rendered page. The system will display additional error information.
  
''Remember to return here and uncheck Display Errors when you are finished troubleshooting. Leaving error display enabled can be a security concern.''
+
''Remember to disable Display Errors when you are finished troubleshooting. Leaving error display enabled can be a security concern.''
  
 
===Enabling From Your Configuration File===
 
===Enabling From Your Configuration File===
If the error is severe enough, you may find you are unable to login to the admin area. In those situations, there is a manual configuration file flag option that you can add to the configuration.php file in the WHMCS root directory to enable error reporting.
 
  
The lines needs to be added at the very end of the configuration.php file, right before the closing PHP tag (''?>'') if your configuration.php file has one, otherwise just the last line in the file.
+
If the error is severe enough, you may not be able to log in to the admin area. In those situations, there is a manual configuration file flag option that you can add to the <tt>configuration.php</tt> file in the WHMCS root directory to enable error reporting.
 +
 
 +
Add the lines to the end of the <tt>configuration.php</tt> file. This will be immediately before the closing PHP tag (''?>'') if your <tt>configuration.php</tt> file has one. If it doesn't, this will be after the last line in the file.
  
 
<source lang="php">
 
<source lang="php">
Line 39: Line 49:
 
</source>
 
</source>
  
After adding the lines and saving/uploading the file, retry the steps that previously led to the "Oops!", blank, or partially rendered page and further error information should be displayed.
+
After adding the lines and saving and uploading the file, retry the steps that previously led to the blank or partially rendered page. The system will display additional error information.
  
''Again remember to return here and remove these lines when you are finished troubleshooting. Leaving error display enabled can be a security concern.''
+
''Remember to disable '''Display Errors''' when you are finished troubleshooting. Leaving error display enabled can be a security concern.''
  
 
==Disabling Error Reporting==
 
==Disabling Error Reporting==
 +
 
===Disabling from the admin area===
 
===Disabling from the admin area===
If you enabled error reporting via the admin area, please ensure you follow the steps below once troubleshooting is completed:
 
  
# Navigate to Setup > General Settings > Other
+
If you enabled error reporting via the admin area, make sure to follow the steps below after you finish troubleshooting:
# Untick the Display Errors checkbox located towards the bottom of the page
+
 
# Click Save Changes
+
# Navigate to '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > General Settings''' or, prior to WHMCS 8.0, '''Setup > General Settings'''.
 +
# Choose the '''[[Other Tab|Other]]''' tab.
 +
# Deselect '''Display Errors''' at the bottom of the page.
 +
# Click '''Save Changes'''.
 +
 
 
===Disabling from the configuration.php file===
 
===Disabling from the configuration.php file===
If you enabled error reporting via the configuration.php file, please ensure you remove the following line from the configuration.php file once troubleshooting is completed:
+
 
 +
If you enabled error reporting via the <tt>configuration.php</tt> file, make sure to remove the following line from the <tt>configuration.php</tt> file after you finish troubleshooting.
  
 
<source lang="php">
 
<source lang="php">
Line 57: Line 72:
 
</source>
 
</source>
  
Occasionally we see the following lines in configuration.php files as well:
+
Sometimes, you may also see the following lines in <tt>configuration.php</tt> file:
  
 
<source lang="php">
 
<source lang="php">
Line 63: Line 78:
 
$display_errors = E_ALL;
 
$display_errors = E_ALL;
 
</source>
 
</source>
As a precaution, it is best to remove any lines starting with $display_errors from the configuration.php file.
+
 
 +
As a precaution, remove any lines starting with <tt>$display_errors</tt> from the <tt>configuration.php</tt> file.
 +
 
 +
==PHP Warnings and Notices==
 +
 
 +
If the Display Error options are disabled and you're still seeing warning messages, it indicates the Error Reporting level in your server's PHP configuration is too high. This is a PHP configuration level issue. Shared hosting or reseller users may require the assistance of the hosting provider.
 +
 
 +
If you have sufficient access and have configured your server to use WHM for administration, follow these steps:
 +
 
 +
# In WHM, navigate to '''Software >> MultiPHP INI Editor'''.
 +
# Click the '''Editor Mode''' tab.
 +
# Select your PHP version from the '''Select a PHP version''' menu.
 +
# Scroll down to the <tt>error_reporting</tt> setting.
 +
# Change the value to the following string:
 +
<source lang="sql">E_ALL & ~E_WARNING & ~E_USER_WARNING & ~E_NOTICE & ~E_USER_NOTICE & ~E_STRICT & ~E_DEPRECATED & ~E_USER_DEPRECATED</source>
 +
 
 +
If you have set it correctly, the <tt>error_reporting</tt> variable within the server's PHP configuration will show a numerical value of <tt>4597</tt>.

Latest revision as of 11:39, 12 July 2023

Getting Error Information

The WHMCS Error Management system includes many useful options. Display Errors allows you to view additional information about critical errors.

When Should You Enable Display Errors

Display Errors provides additional information when you experience a critical error that results in one of the following issues:

  • Friendly "Oops!" pages
  • Entirely blank pages
  • Partially rendered pages

In most cases, use the Log Errors and SQL Debug Mode options first. These options will usually capture the same information that Display Errors renders. In the event that these options are not viable or do not yield any information, Display Errors is a good alternative.

Display Errors will show your error information to anyone who is encountering the same error condition. Avoid showing errors to visitors or non-privileged staff whenever possible.

Typical Causes

Some of the most common causes of "Oops!", partial, or empty page rendering include:

  • Missing or corrupted files or incomplete uploads.
  • The server doesn't meet the minimum system requirements.
  • PHP, Apache, or ionCube Loader®-related errors.
  • Incompatible hooks or addons.
  • Syntax errors in custom modules, hooks, or templates.

Enabling Error Reporting

Enabling From The Admin Area

If possible, attempt the following steps to enable Display Errors via the Admin Area:

  1. Go to Configuration () > System Settings > General Settings or, prior to WHMCS 8.0, Setup > General Settings.
  2. Choose the Other tab.
  3. Select Display Errors.
  4. Click Save Changes.
  5. Retry the steps that previously led to the blank or partially-rendered page. The system will display additional error information.

Remember to disable Display Errors when you are finished troubleshooting. Leaving error display enabled can be a security concern.

Enabling From Your Configuration File

If the error is severe enough, you may not be able to log in to the admin area. In those situations, there is a manual configuration file flag option that you can add to the configuration.php file in the WHMCS root directory to enable error reporting.

Add the lines to the end of the configuration.php file. This will be immediately before the closing PHP tag (?>) if your configuration.php file has one. If it doesn't, this will be after the last line in the file.

$display_errors = true;

After adding the lines and saving and uploading the file, retry the steps that previously led to the blank or partially rendered page. The system will display additional error information.

Remember to disable Display Errors when you are finished troubleshooting. Leaving error display enabled can be a security concern.

Disabling Error Reporting

Disabling from the admin area

If you enabled error reporting via the admin area, make sure to follow the steps below after you finish troubleshooting:

  1. Navigate to Configuration () > System Settings > General Settings or, prior to WHMCS 8.0, Setup > General Settings.
  2. Choose the Other tab.
  3. Deselect Display Errors at the bottom of the page.
  4. Click Save Changes.

Disabling from the configuration.php file

If you enabled error reporting via the configuration.php file, make sure to remove the following line from the configuration.php file after you finish troubleshooting.

$display_errors = true;

Sometimes, you may also see the following lines in configuration.php file:

$display_errors = E_NOTICE;
$display_errors = E_ALL;

As a precaution, remove any lines starting with $display_errors from the configuration.php file.

PHP Warnings and Notices

If the Display Error options are disabled and you're still seeing warning messages, it indicates the Error Reporting level in your server's PHP configuration is too high. This is a PHP configuration level issue. Shared hosting or reseller users may require the assistance of the hosting provider.

If you have sufficient access and have configured your server to use WHM for administration, follow these steps:

  1. In WHM, navigate to Software >> MultiPHP INI Editor.
  2. Click the Editor Mode tab.
  3. Select your PHP version from the Select a PHP version menu.
  4. Scroll down to the error_reporting setting.
  5. Change the value to the following string:
E_ALL & ~E_WARNING & ~E_USER_WARNING & ~E_NOTICE & ~E_USER_NOTICE & ~E_STRICT & ~E_DEPRECATED & ~E_USER_DEPRECATED

If you have set it correctly, the error_reporting variable within the server's PHP configuration will show a numerical value of 4597.