Topic on Extension talk:Math

Math extension cannot connect to Restbase.

Tunglinwu (talkcontribs)

解析失敗 (MathML 使用 SVG 或 PNG 備用 (建議用於現代瀏覽器與輔助工具):從伺服器 "" 收到無效的回應 ("Math extension cannot connect to Restbase.")。) is error so many times.

Libattery (talkcontribs)
Libattery (talkcontribs) (talkcontribs) (talkcontribs)

This extension seems dead.

Plasma g (talkcontribs)

I was having the same problem, but by changing a line in LocalSettings.php to

$wgMathFullRestbaseURL= '';

and running "php update.php", the problem went away. So I think the above statement "This extension seems dead" is not the definitive word.

Ciencia Al Poder (talkcontribs)

Pointing $wgMathFullRestbaseURL to wikipedia doesn't seem to work since MediaWiki 1.30 (talkcontribs)

It works for me with MediaWiki 1.30 and LAMP on Ubuntu 18.04 machine

Ciencia Al Poder (talkcontribs)

I later discovered it doesn't work when you have RestBase installed and configured for Visual Editor. Otherwise it should work.

2A02:C7D:8A41:1E00:45F7:8FB3:DA76:93EE (talkcontribs)

Has anyone had this problem again recently because it's suddenly occurred on my wiki? I tried the alternate Restbase Urls but nothing has worked.

Anu8791 (talkcontribs)

We also observed following Math/LaTex rendering to PNG issue while upgraded from MediaWiki 1.30.0 to MediaWiki 1.31.1. But, it's not the issue in earlier version (1.30.0)

(Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "":): {\displaystyle \sigma_1^\prime} and Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "":):

Ciencia Al Poder (talkcontribs)

Looks like a problem with wikipedia servers...

Anu8791 (talkcontribs)

We were not using Mathoid Server as a service in earlier MediaWiki v1.30.0. hence the Math/LaTex rendering to PNG was just working fine with LaTex/DVI libs.

but, when we upgraded to this MediaWiki v 1.31.1, the above issue is occurred in the same server environment.

Hence, could you let know how we can bypass the Mathoid Server dependency in this LTS version(MediaWiki 1.31.1) and still we can make Math render working as it's working in MediaWiki 1.30.0 ?

Ciencia Al Poder (talkcontribs)

If you do not install mathoid (and RESTBase), you may use wikipedia's RESTBase, which is what it's using now by default. However, you must ensure PHP is able to connect to wikipedia, which is probably blocked by one of your firewalls or SELinux and that's the error message you're getting

Anu8791 (talkcontribs)

There is security restrictions to connect from our corporate network to the internet. so I unable to test wiki's Restbase

Hence, I have install for the 'methoid' webservice in our local RHEL7 server. I have opted for the dev-config available in the Mathoid package. Now the daemon is running with following pid. But, I see the listening server IP indicates

{"name":"mathoid","hostname":"","pid":23788,"level":30,"levelPath":"info","msg":"Worker 23788 listening on","time":"2019-06-06T11:21:19.871Z","v":0}

Could you let know how can we get the appropriate IP that need to configure with below parameters for Math in LocalSettings.php ? I have already checked with 'domainname:port' is still not working for following configuration in LocalSettings.php

wfLoadExtension( 'Math' );

$wgDefaultUserOptions['math'] = 'mathml';

$wgMathMathMLUrl = '';

Ciencia Al Poder (talkcontribs)

I think you also need RESTBase, or at least this is how I have configured (what would be the purpose of RESTBase, after all?). Then $wgMathMathMLUrl points to RESTBase, and you enable the math endpoint in RESTBase to point to mathoid daemon.

Anu8791 (talkcontribs)

Actually RESTBase server implementation along with Mathoid server is required only when you are running such a Huge WIKI.

But for small enterprise wiki with limited memory to render math formulae, we need to install/setup/configure the Mathoid server for WIKI locally in the RHEL7 server followed with below steps.

** First Install Mathoid server pre-requisites packages dependency in RHEL7 server.

# yum update -y [required when need to update latest packages available in the server]

# yum install -y epel-release

# yum install -y gcc-c++ nodejs npm mocha librsvg2-devel pkgconfig git

# yum groupinstall -y 'Development Tools'

** Second, Install Mathoid server in the desired server location.

# cd /var/data/wiki/

# git clone

# chown -R apache:wikiadm mathoid

# cd mathoid

# chmod 775 server.js cli.js

** Third, Run the Mathoid server and test

# npm install

# npm test

** Fourth, Add below lines under LocalSettings.php to map mathoid server with mediawiki

$wgMathoidCli = ['/var/data/wiki/mathoid/cli.js', '-c', '/var/data/wiki/mathoid/config.yaml'];

# Below lines required to add in LocalSettings.php to Opt Mathoid server test-config as dependency

[Note. Ensure you already got installed below Math extension compatible with the MediaWiki version]

wfLoadExtension( 'Math' );

$wgMathValidModes[] = 'mathml';

$wgDefaultUserOptions['math'] = 'mathml';

$wgMathMathMLUrl = '';

** Fifth, Change below line is the api interface for MediaWiki in Mathoid server config.yaml

uri: https://Template:Domain/api.php

Restart HTTPD server : # systemctl restart httpd

You are all DONE !

The math formula should render to desired formats in .png ! (talkcontribs)

Any ideas? Same problem here. (talkcontribs)

Can anyone provide a simple php_curl request that Math could make to wiki's Restbase, in order to test whether this is a problem of the code or a problem of the web host?

Thank you!

This post was hidden by Anu8791 (history)
Johanngan (talkcontribs)

I tried connecting to both the Wikimedia and Wikipedia Restbases with the same problem (MediaWiki 1.32). The issue in my case was with how the MediaWiki core handles HTTP responses. I haven't seen anyone else mention it, so here's my other comment on the issue with two hacks. (talkcontribs)

I used one of Johanngan's hacks above and it works!

See that thread I will post some more details (talkcontribs)

This suddenly started happening on my MediaWiki1.28 install. Johanngan's second hack worked perfectly. Many thanks!

Reply to "Math extension cannot connect to Restbase."