MediaWiki fix “Error: Class “FormatJson” not found” after migration

May 13th, 2023





An example LocalSettings file for MediaWiki.

An example LocalSettings file for MediaWiki.

After moving servers, I was no longer able to access my MediaWiki instance. It would error out when attempting to load a page.

Main_Page Error: Class "FormatJson" not found

There is a thread on this issue on the MediaWiki discussion forums, but for me, the issue was not that I had missing files.

The files in question were present and were not corrupt and reinstalling for some reason didn’t fix it.

Sometimes this issue can occur when the file is moved and not refreshed such as after a server migration. The fix is to change the update time on the file by running the following command within the MediaWiki install directory:

touch includes/json/FormatJson.php

After that a hard refresh showed the correct content.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *