• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue error stream: 'PHP Fatal error: Cannor redeclare error() deprecatedlib.php (Moodle)

Marc Pol

New Pleskian
Hi,

A customer of ours tries to upgrade his moodle website from version 3.9.1 to 3.9.2-137. During the upgrade he gets the following message: error stream: 'PHP Fatal error: Cannor redeclare error() in /var/www/vhosts/exampledomain/httpdocs/lib/deprecatedlib.php on line 686

Now i opend the file deprecated lib on line 686 and says the following:


/**
* @deprecated since 2.0
*/
function error() {
throw new coding_exception('notlocalisederrormessage', 'error', $link, $message, 'error() is a removed, please call
print_error() instead of error()');
}

So, i tried to comment the deprecated function and re-run the upgrade. Still the same error. After that i enabled plesk logging to see what is going on. I did see in the log that the moodle package is being cahed. See this line:

ERR [panel] PleskUtilException: '/usr/local/psa/admin/bin/sappmng' '--run-application-script' '--script-file-name=configure' '--script-name=upgrade' '--script-language=php' '--user-name=exampleuser' '--php-cli=/opt/plesk/php/7.3/bin/php' '--php-ini=/var/www/vhosts/system/exampledomain/etc/php.ini' '--application-full-name=file:////usr/local/psa/var/apspackages/adiMLWzLe.zipa1d1241c-ccdb-5acb-be14/cache' '--' '3.9.1' '136' failed with code 255.

From there i headed to the cached package and finded the same deprecated function in: /usr/local/psa/var/apspackages/adiMLWzLe.zipa1d1241c-ccdb-5acb-be14/cache/htdocs/lib/deprecatedlib.php and removed the @deprecated since 2.0 function. After that I re-runned the upgrade. It worked! Could it be that plesk is pulling a wrong package of is something realy deprecated in the website of the customer, or do i not understand what is happening here.


moodle version: 3.9.2-137
plesk version: Plesk Obsidian 18.0.29
Centos version: CentOS Linux 7.8.2003 (Core)
 
Dear Marc Pol,
Thank You Very Much for your insight!
Several Moodle sites on our server showed blank pages in the place of regular main and login pages: enabling the debug mode revealed the same error that you have described. When we commented out these 4 lines of code everything returned to normal operation.
moodle versions: from 3.7 to 3.10.4
plesk version: Plesk Obsidian 18.0.37
Centos version: CentOS Linux 7.9.x (Core)
 
Back
Top