# Topic on Project:Support desk

## [RESOLVED] Math display error.

18

Hi, I get the error message "Failed to parse (PNG conversion failed; check for correct installation of latex and dvipng (or dvips + gs + convert)): x+y=2" when trying to display any math formula.

MediaWiki 1.17 PHP 5.36 SQLite (tried using mysql but it was not listed during installation). In case it matters, running OS X Snow Leopard.

The program texvc actually seems to work -- ran from command line and it generated the png. Not sure what to try now. Any help appreciated. Thanks.

Could be a permissions error, check the user apache runs as has permission to create necessary files and execute texvc. When trying to run texvc from command line, make sure you're using the same command as mediawiki uses and its saving the file in the same folder as mediawiki would (You can get the command actually used from the debug log)

Thanks, I think I have a much better idea what's going on. However I'm still getting the "failure to parse" error. At first I had set owner to _www and I couldn't, with my user, get texvc to make the png. I made a new tmp with me as the owner and then I was able to produce the png. I chmoded tmp to 777. What permissions/who needs to own tmp in order for it to work? If it worked, would there be a png left in the tmp folder? Thanks again.

Which user your web server runs as varries depending on OS. Debian and Unbuntu generally uses www-data as the user (but no matter what user, 777 gives everything, so if it still doesn't work after that, there's something other then permissions wrong). Also be careful which temp folder. Generally MediaWiki uses images/tmp and images/math I think. Usually it puts the intermediate tex files in images/tmp and then puts the png in images/math.

Yeah, that's what I figured about permissions. I'm looking at the debug log file but to be honest there does not seem to be much info there. I can see the command that it's using (which I can run just fine from command line) but I don't see anything like the error message I get. I feel like I'm so close. I have all the necessary programs installed. Texvc runs fine from command line and I have permissions set to 777 temporarily. If anyone has dealt with this error on a mac I could really use the help.

Ok...found the solution finally. The solution was to specify the absolute path to the different programs in the file render.ml. I have no idea why there would be a problem as they were originally since the user _www had access to those commands in its Path, but I'm glad I got it to work. Thanks.

i'm having the very same problem, what exactly do i need to do?

Having the same problem ? Any solution ?

If you have read the thread and are not able to solve your problem, it is best if you start a new thread.

I am having the same kind of problem. And I got the ERROR MSG "Failed to parse (PNG conversion failed; check for correct installation of latex and dvipng (or dvips + gs + convert))"

But I got the same configuration works in Test environment. Still I got the error Please suggest.

I have followed below steps with no success.

* Updated packages installed

ls -lH which gs which latex which dvips which convert which dvipng which texvc

-rwxr-xr-x. 1 root   root     16240 Feb 27  2015 /usr/bin/convert

-rwxr-xr-x. 1 root   root    107728 Apr 27  2010 /usr/bin/dvipng

-rwxr-xr-x. 1 root   root    208000 Aug 28 19:10 /usr/bin/dvips

-rwxr-xr-x. 1 root   root     19104 Feb 20  2015 /usr/bin/gs

-rwxr-xr-x. 1 root   root    666360 Aug 28 19:10 /usr/bin/latex

-rwxrwxrwx. 1 apache wikiadm 635300 Feb  2 16:36 /usr/bin/texvc

* applied full access (777) to Tmp,math under /Imaages directory

* Added below props inside extensions.d/math.php

$wgUseTeX = true;$wgTexvc = "/usr/bin/texvc";

$wgLatexCommand = "/usr/bin/latex";$wgImageMagickConvertCommand = "/usr/bin/convert";

* Increased Shell Memory at LocalSettings : $wgMaxShellMemory = 524288; which seems to be enough to render PNG. * Allowed unlimited (cpu time, virtual memory,filesize) # /bin/bash # ulimit -t$1 -v $2 -f$3

But the error seems more appropriate for installing texvc. Please let me know how to re-install for same.

Sanjay

This comment was hidden by Atcovi (history)

I can able to generate dynamic PNG files inside //images/math' with the below command Line

# texvc /data/www/html/wiki/images/tmp /data/www/html/wiki/images/math "y=x+2"

But still the new formula used in WIKI page does not generate dynamic PNG files . Please let me know for the solution if I could missed some of additional configuration as below.

require_once("/data/www/html/test3/extensions/Math/Math.php");

$wgUseTeX = true;$wgTexvc = "/data/www/html/test3/extensions/Math/math/texvc.exe";

$wgMathTexvcCheckExecutable = "/data/www/html/test3/extensions/Math/texvccheck/texvccheck.exe";$wgLaTexCommand  = "/var/lib/texmf/web2c/pdftex/latex.fmt";

Sanjay

I'm surprised to see references to texvc.exe and texvccheck.exe on what it seems to be a linux environment... are you sure your configuration is correct?

Yes, WIKI application is in Linux environment. Now, I have the below configurations.

require_once("/data/www/html/test3/extensions/Math/Math.php");

$wgUseTeX = true;$wgTexvc = "/data/www/html/test3/extensions/Math/math/texvc";

$wgMathTexvcCheckExecutable = "/data/www/html/test3/extensions/Math/texvccheck/texvccheck";$wgLaTexCommand  = "/var/lib/texmf/web2c/pdftex/latex.fmt";

But, still getting the error while adding a new formula : Failed to parse (PNG conversion failed; check for correct installation of latex and dvipng (or dvips + gs + convert)): \tau _{a}

Note : I have provided full access rights (777) to the /math folder under /images where the dynamic PNGs will be generated.

Please any help to get the issue resolved.

You can set a debug log as described in Manual:How to debug, it should write there the exact command used to render the formula image, and see if it also catches any error message. You can also execute that command directly from the shell to see if it gives you an error message

I have enabled below in LocalSettings.php but it seems nothing worked out. Further I did not get any error in page for the new math formula Error displayed like : Failed to parse (PNG conversion failed; check for correct installation of latex and dvipng (or dvips + gs + convert)): \tau _{a}

error_reporting( -1 );

ini_set( 'display_errors', 1 );

The debug log is one setting, different from the error_reporting, etc. The error doesn't seem to come from php so error_reporting will do nothing here, you can only see the command in the debug log

Finally, I got the issue resolved following with the below steps.

1. I searched for the latex.fmt with command # find / -name latex.fmt
2. I found the same file in two different location in the server and that was required to copy in /tmp folder inside /images
3. /var/lib/texmf/web2c/pdftex/latex.fmt & /.texlive2007/texmf-var/web2c/pdftex/latex.fmt
4. I have renamed the latex.fmt at the location : /.texlive2007/texmf-var/web2c/pdftex
5. Restarted Apache server and issue got resolved.

Note : The latest 'latex.fmt' would be auto created at the same location where it was renamed.

Thank You !

Sanjay