Difference between revisions of "PHP 7 Migration Troubleshooting Guide"

From WHMCS Documentation

(Created page with "« Back to the PHP 7 Migration Guide If following a change of PHP version you encounter an Oops error page, or blank or partially rendered page...")
(No difference)

Revision as of 13:54, 29 March 2018

« Back to the PHP 7 Migration Guide

If following a change of PHP version you encounter an Oops error page, or blank or partially rendered page, the most likely cause is that there is a file present in your installation that is not compatible with the new PHP version.

Possible causes include:

  • Use of old deprecated or removed functions that are no longer available in the newer version of PHP
  • Use of old ionCube encoding that is no longer compatible with the newer version of PHP

To confirm the exact cause of the issue, you will need to enable error reporting.

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.

Resolving the Issue

With error reporting enabled, you should see the full error message being generated at the time the problematic PHP file is attempted to be included/executed. Below are some of the most common errors you may encounter.

The file /path/to/file.php was encoded by the ionCube Encoder for PHP 5.6 and cannot run under PHP 7.1 or later. Please ask the provider of the script to provide a version encoded with the ionCube Encoder for PHP 7.1. -OR- The file /path/to/file.php was encoded by the ionCube Encoder for PHP 5.6 and cannot run under PHP 7.2 or later. Please ask the provider of the script to provide a version encoded with the ionCube Encoder for PHP 7.2.

Seeing the above error message indicates the itemised file was encoded using an older version of ionCube Encoder that does not include support for PHP 7.1 or later. You will need to contact the original vendor/author of the file to ask for an updated version of the file.

If the file is a WHMCS file (you can determine this by looking at head of the file and looking for the WHMCS copyright notice), it is highly possible that it is a file that we no longer maintain or distribute. Typically these files will have been removed automatically by the update routines built into WHMCS, but if at any time permissions did not allow for its' removal, it is possible for some files to remain. In most cases it will no longer be being used, and if it relates to a module that you do not use, it should be safe to simply delete it. If you are unsure, our support team will be able to assist you in making this determination.

« Back to the PHP 7 Migration Guide