The "Notice: Only variable references should be returned by reference" error in Moodle is the same PHP compatibility issue that affects several older PHP applications. The code uses a syntax pattern that modern PHP versions flag as incorrect.
Update Moodle to the latest version
Current versions of Moodle have resolved these PHP compatibility issues. Visit moodle.org to download the latest release. If you cannot update immediately, suppress PHP notices via cPanel > Software > MultiPHP INI Editor.
01. Update Moodle
The proper fix is to update Moodle. Before updating:
- Back up your database and files - See How to Back Up Your Website
- Check Moodle's system requirements for the version you are upgrading to (PHP version, database version, etc.)
- Update PHP if needed - See How to Change Your PHP Version
- Follow Moodle's upgrade documentation at moodle.org
02. Temporary Fix: Suppress Notices
PHP notices are informational messages, not errors. Your Moodle installation still functions with these notices appearing. To hide them, create a .user.ini file in your Moodle directory:
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
Or use cPanel > Software > MultiPHP INI Editor to change the error reporting level for your domain.
Moodle is a complex application used for education. Running an outdated version poses security risks for both you and your users' data. If you manage student information, updating is especially important for data protection compliance.
Need Help With Moodle?
If you need assistance updating Moodle or resolving PHP errors, open a support ticket.
Open a Support TicketQuick Recap
- This is a PHP compatibility notice, not a fatal error
- Update Moodle for the proper fix
- Suppress notices temporarily via .user.ini if you cannot update yet
- Back up everything before updating
- Check PHP version requirements for the new Moodle version
PHP script compatibility · Last updated March 2026 · Browse all PHP Scripts articles
