Question: WHMCS PHP script returns error: encoded as type [1/72] cannot be decoded by this version of the ionCube Loader
Symptoms
- The domain related to the PHP script file mentioned in the error was recently switched to utilize PHP 8.x
- instead of PHP 7.x in Plesk
- The PHP script that is related to the error is provided by WHMCS
- The website Apache log /var/www/vhosts/example.com/logs/error_log contains the following error:
[Wed Mar 29 09:01:48.997577 2023] [proxy_fcgi:error] [pid 19415:tid 140112847406848] [client 203.0.113.2:38884] AH01071: Got error 'PHP message: PHP Fatal error: The file /var/www/vhosts/example.com/httpdocs/admin/index.php encoded as type [1/72] cannot be decoded by this version of the ionCube Loader.\n in Unknown on line 0', referer:
- The following error is visible in the PHP /var/log/plesk-php8X-fpm/error.log:
[29-Mar-2023 09:27:38] WARNING: [pool example.com] child 39978 said into stderr: " in Unknown on line 0"
[29-Mar-2023 09:50:41] WARNING: [pool example.com] child 49162 said into stderr: "PHP message: PHP Fatal error: The file /var/www/vhosts/example.com/httpdocs/index.php encoded as type [1/72] cannot be decoded by this version of the ionCube Loader."
CauseThe WHMCS PHP script is incompatible with the new ionCube version and is thus unable to run. The official ionCube 12 usage guide contains the following text within its
PHP Compatibility section:
With ionCube it is possible to encode one set of files and run those on multiple higher PHP versions for the same major version of PHP. For example, [...] Files encoded with the PHP 7.1 language setting can be run on PHP 7.1, 7.2 and 7.4 machines. Files encoded for PHP 8.1 can run on PHP 8.1, and may also run on future versions of PHP 8.The portion of the error message that states "encoded as type [1/72]" means that the file was encoded with PHP 7.2 and cannot be decoded by the currently set PHP 8.x version.
ResolutionThe issue stems from ionCube's PHP compatibility and the encoding used for the WHMCS PHP script.
To resolve it:
Set PHP to 8.1, then follow the instructions in this WHMCS guide to remove incompatible files and upgrade WHMCS:
https://help.whmcs.com/m/troubleshooting/l/700394-troubleshooting-ioncube-errors#the-file-path-filename-php-encoded-as-type-1-71-cannot-be-decoded
If it does not help, contact WHMCS support