Topic on Extension talk:Math

Jump to navigation Jump to search

Math extension cannot connect to Restbase.

22
Tunglinwu (talkcontribs)

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

http://api.formulasearchengine.com/v1/ is error so many times.

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

This extension seems dead.

Plasma g (talkcontribs)

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

$wgMathFullRestbaseURL= 'https://en.wikipedia.org/api/rest_';

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

193.147.143.68 (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 "https://en.wikipedia.org/api/rest_v1/":): {\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 "https://en.wikipedia.org/api/rest_v1/":):

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 0.0.0.0:10044


{"name":"mathoid","hostname":"domainname.com","pid":23788,"level":30,"levelPath":"info","msg":"Worker 23788 listening on 0.0.0.0:10044","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 = 'https://domainname.com:10044/';

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 https://github.com/wikimedia/mathoid/

# 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 = 'http://12.23.34.45:10044/';


** 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 !


38.124.157.153 (talkcontribs)

Any ideas? Same problem here.

128.12.92.43 (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.

123.51.111.134 (talkcontribs)

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

See that thread I will post some more details

Reply to "Math extension cannot connect to Restbase."