I have the solution. I switched on every conceivable debugging option listed in:
Manual:How to debug
These settings are to be added to LocalSettings.php, as follows:
1. At the top, right under <?php
error_reporting( -1 );
ini_set( 'display_errors', 1 );
2. At the bottom, underneath "# Add more configuration options below."
$wgShowExceptionDetails = true;
$wgDebugToolbar = true;
$wgShowDebug = true;
$wgDevelopmentWarnings = true;
$wgDebugDumpSql = true;
I then started requesting the visual editor URL in a new tab, incrementally subtracting query parameters until I discovered that leaving off the json query parameter gives me a proper error output as expected from the debug options which were previously enabled.
(http obfuscated to evade spam filter) hxxp://<your domain>/api.php?action=visualeditor&format=json&paction=parse&page=Main_Page&uselang=en&formatversion=2
In other words, at some point I got to format=json, removed it, reloaded and got the following output:
{
"message": "Error: exception of type RuntimeException: bcmath or gmp extension required for 32 bit machines.",
"exception": {
"id": "f1802bf2024967674634873f",
"type": "RuntimeException",
"file": "/var/www/html/includes/libs/uuid/GlobalIdGenerator.php",
"line": 637,
"message": "bcmath or gmp extension required for 32 bit machines.",
"code": 0,
"url": "/rest.php/<your domain>/v3/page/html/Foo1/14?redirect=false&stash=true",
"caught_by": "other",
"backtrace": [
{
"file": "/var/www/html/includes/libs/uuid/GlobalIdGenerator.php",
"line": 222,
"function": "intervalsSinceGregorianBinary",
"class": "Wikimedia\\UUID\\GlobalIdGenerator",
"type": "->",
"args": [
"array",
"integer"
]
},
{
"file": "/var/www/html/includes/libs/uuid/GlobalIdGenerator.php",
"line": 211,
"function": "getUUIDv1",
"class": "Wikimedia\\UUID\\GlobalIdGenerator",
"type": "->",
"args": [
"array"
]
},
{
"file": "/var/www/html/includes/utils/UIDGenerator.php",
"line": 88,
"function": "newUUIDv1",
"class": "Wikimedia\\UUID\\GlobalIdGenerator",
"type": "->",
"args": []
},
{
"file": "/var/www/html/extensions/VisualEditor/includes/VEParsoid/src/Rest/Handler/ParsoidHandler.php",
"line": 610,
"function": "newUUIDv1",
"class": "UIDGenerator",
"type": "::",
"args": []
},
{
"file": "/var/www/html/extensions/VisualEditor/includes/VEParsoid/src/Rest/Handler/PageHandler.php",
"line": 90,
"function": "wt2html",
"class": "VEParsoid\\Rest\\Handler\\ParsoidHandler",
"type": "->",
"args": [
"VEParsoid\\Config\\PageConfig",
"array"
]
},
{
"file": "/var/www/html/includes/Rest/Router.php",
"line": 414,
"function": "execute",
"class": "VEParsoid\\Rest\\Handler\\PageHandler",
"type": "->",
"args": []
},
{
"file": "/var/www/html/includes/Rest/Router.php",
"line": 338,
"function": "executeHandler",
"class": "MediaWiki\\Rest\\Router",
"type": "->",
"args": [
"VEParsoid\\Rest\\Handler\\PageHandler"
]
},
{
"file": "/var/www/html/includes/Rest/EntryPoint.php",
"line": 168,
"function": "execute",
"class": "MediaWiki\\Rest\\Router",
"type": "->",
"args": [
"MediaWiki\\Rest\\RequestFromGlobals"
]
},
{
"file": "/var/www/html/includes/Rest/EntryPoint.php",
"line": 133,
"function": "execute",
"class": "MediaWiki\\Rest\\EntryPoint",
"type": "->",
"args": []
},
{
"file": "/var/www/html/rest.php",
"line": 31,
"function": "main",
"class": "MediaWiki\\Rest\\EntryPoint",
"type": "::",
"args": []
}
]
},
"httpCode": 500,
"httpReason": "Internal Server Error"
}
I was using Docker, and I needed to install bcmath.
In docker, first you enter the Docker container (named "mediawiki" in my case, you may have a different name, or even a hashed id) and start a shell inside it like so:
docker exec -it mediawiki /bin/bash
Then, you install bcmath, like so:
docker-php-ext-install bcmath
Then, you exit, and you restart the container, like so:
docker restart mediawiki
Visual editing now works. This was necessary for me, because my Docker image runs on ARM 32-bit.
Note that e.g. x86 Ubuntu users running php 7.4 can install the package with:
sudo apt update && sudo apt -y install php7.4-bcmath
...And they can adjust the php version in the package name to a different version if so required.