Error Excepción - syntax error, unexpected '|', expecting variable (T_VARIABLE)

Excepción - syntax error, unexpected ‘|’, expecting variable (T_VARIABLE)

Hi and welcome to the forum! I don’t see this error on your website. Maybe you fixed it? If that happens again, can you please share where you have the problem so we can help you better?


Nobody can help you if you do not provide more details lol, it literally says that you have a syntax error which you need to fix.


How to fix this problen?

Can you provide the code?
Format the code like this


where can i get the code

…What do you mean “where can i get the code”? Are you not the one who has coded it?


When I log into the moodle admin account I get this error code

Exception - syntax error, unexpected ‘|’, expecting variable (T_VARIABLE)

If you want, I’ll give you the administrator’s login so you can check it yourself.

Please do one of the following (Or both):

  • Re-install the script
  • Ask the developer of the script for support

Ok Thaks

1 Like

Hi there.

Moodle told me that I have to update the PHP version.

How is it updated?

You can’t update PHP on free hosting, but PHP 8.1’s rollout is in the works, only after iFastNet sorted out the missing extensions. Premium Hosting has it already though, and same goes for PHP 8.2.


You can always use an older version of Moodle that supports PHP 7.4, such as Moodle 4.1, and upgrade to the latest when support for PHP 8.x is added.

More information on which PHP versions are supported/required by which versions of Moodle:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.