No output from TeX filter debug

No output from TeX filter debug

by Matthew Fox -
Number of replies: 10

I have installed MiKTeX, GhostScript and ImageMagick on a Windows Moodle 2.1 server with IIS.  I have allowed the default user to use cmd.exe and read and execute commands in the folder where MiKTeX is installed.  The filter page in Moodle shows that the executables are readable with green checks beside them.  But, when I try to use the /filter/tex/texdebug.php page to test it, the TeX/GS image does not show.  The command exec output doesn't seem to be running the commands.  If I copy the commands from the page into a command line, they run and produce output.  I assume that the same kind of output should be visible on th debuging page, but all I get is this:

Checking executables

latex executable (C:\...\miktex\bin\latex.exe) is readable
dvips executable (C:\...\miktex\bin\dvips.exe) is readable
convert executable (C:\...\imagemagick\convert.exe) is readable

base filename for expression is 'dae478d8aae49f8a28c027fb53abca91'

Processing TeX expression:

f(x)=\int_{-\infty}^x~e^{-t^2}dt^2
$ C:\....\miktex\bin\latex.exe --interaction=nonstopmode D:\moodle....../temp/latex/dae478d8aae49f8a28c027fb53abca91.tex
OUTPUT: 
RETURN CODE: 1
$ C:\...\miktex\bin\dvips.exe -E D:\moodle...../temp/latex/dae478d8aae49f8a28c027fb53abca91.dvi -o D:\moodle....../temp/latex/dae478d8aae49f8a28c027fb53abca91.ps
OUTPUT: 
RETURN CODE: 1
$ C:\...\imagemagick\convert.exe -density 240 -trim D:\moodle....../temp/latex/dae478d8aae49f8a28c027fb53abca91.ps D:\moodle....../temp/latex/dae478d8aae49f8a28c027fb53abca91.png 
OUTPUT: 
RETURN CODE: 1

 

It looks to me like it isn't even executing the commands.  The only file in the temp\latex directory is the .tex file.  PHP is not in safe mode.  How can I fix this or at least get more info to diagnose the problem?

Average of ratings: -
In reply to Matthew Fox

Re: No output from TeX filter debug

by Matthew Fox -

More Info

I created a test page that tries to run the first command, but appended  " 2>&1" to the command line, then prints the output.  Now the output says:

initexmf.exe: Windows API error 5: Access is denied.

The initexmf.exe is in the MiKTeX\bin directory, which the user has read and execute rights.  I tried elevating rights to that directory to full control, but I get the same error.  It looks like the user does not have sufficient access to the Default User\Local Settings\Application Data\MiKTeX folder.  Is the install of MiKTeX supposed to be a single- or multi-user install?

In reply to Matthew Fox

Re: No output from TeX filter debug

by Colin Fraser -
Picture of Documentation writers Picture of Testers

multi-user... but I am not sure this is the issue - well it may be if you are using the command line, but why? If you set up TeX properly in Moodle then it should work inside Moodle and then why bother using command line? Also, is this an issue inside Moodle or outside of it?

I have never been able to get MikTeX to work in a Windows command line, but it works well in Moodle, and I use ImageMagik to renderer the script, never used GhostScript. As long as the paths are set right in the Filters page, then there should be no further issue.

$$\frac{3}{5}\ of \sqrt{-1} $$ is still an error... 

In reply to Colin Fraser

Re: No output from TeX filter debug

by Colin Fraser -
Picture of Documentation writers Picture of Testers

well, alright, not the Filters page, but.. the Site Administration > Plugins > Filters >TeX Notation page... duh!... sorry, was being distracted at the time of writing... tongueout

In reply to Colin Fraser

Re: No output from TeX filter debug

by Matthew Fox -

Just to be clear, this works fine from a DOS command prompt.  It does not work from PHP using the same command line in a exec() function.

GhostScript is part of MiKTeX and is necessary to convert from DVI to PS.

The frustrating thing is that I have MiKTeX and PHP installed on another IIS server (not Moodle) and it works fine from there.  I copied the PHP I use on that server to the Moodle server and it doesn't work either.  It is definitely an install issue related to the rights of the anonymous user.  I have not found any info on what rights the anonymous user needs to where for MiKTeX to work.

In reply to Matthew Fox

Re: No output from TeX filter debug

by Matthew Fox -

This is the error that the Debug page now throws after granting rights to cmd.exe and modifying the command line to include 2>&1 so the error messages show:

OUTPUT: initexmf.exe: Windows API error 5: Access is denied.
initexmf.exe: Data: C:\Documents and Settings\Default User\Local Settings\Application Data\MiKTeX

The problem is that MiKTeX did not create a MiKTeX directory. It did create one under the All Users directory, but it is not using that one.  When I copy the MiKTeX directory from All Users to Default User and grant access to it, I get this:

OUTPUT: initexmf.exe: Windows API error 5: Access is denied.
initexmf.exe: Data: Software\MiKTeX.org\MiKTeX\2.9\Core

This looks like a registry entry path, so I granted access to the MiKTeX.org branch in the registry, but I still get the same error.  I don't know what else to grant access to.

In reply to Matthew Fox

Re: No output from TeX filter debug

by Mauno Korpelainen -

Usually the problem with IIS is that you have not granted access to correct user - IUSR_<computername> - the Internet Guest user that needs a permission to read and execute, and sometimes also write access...

So if you want to use IIS you usually need to check various settings of IIS with IIS manager (or resource manager) before all file and folder settings are working, see for example this old post http://moodle.org/mod/forum/discuss.php?d=118478

In reply to Matthew Fox

Problem Solved

by Matthew Fox -

I managed to solve the problem.  Apparently, installing MiKTeX 2.9 for all users doesn't really help for the Default user.  Windows still tries to use the application data and registry settings for the Default user (which aren't created) and ignores the All Users settings.  I had to copy a bunch of stuff from the All Users to the default user:

  • Copied MikTeX folders from C:\Documents and Settings\(install user)\Local Settings\Application Data\ and C:\Documents and Settings\All Users\Application Data\ to under the C:\Documents and Settings\Default User\ and granted the Default user access to the folders.
  • In the Registry, exported HKEY_USERS\(install user code)\Software\MiKTeX.org, edited the exported .reg file to change the paths to HKEY_USERS\.DEFAULT\Software\MiKTeX.org, then imported the file back again and granted the default user access to the new MiKTeX.org branch.

After that, it started working.

I found out what the problem was by downloading ProcMon from MS\SysInternals.  Turn capturing off and cleared the log, then just before testing the TeX filter using the debug page, turn the ProcMon capturing on, run the test, then disable capturing.  This is a live server, so there were thousands of log entries in those few seconds, but using the filter in ProcMon I filtered out everything but entries with a result of "ACCESS DENIED".  I found one call where access was denied to the HKEY_USERS\.DEFAULT\Software\MiKTeX.org key, which didn't exist.  After copying the key, it started working.

The question is, how do you install MiKTeX so that the default user can use it correctly without having to doctor your registry?

In reply to Matthew Fox

Re: Problem Solved

by Marc Grober -

Step 1. Get rid of your Microsoft products

Step 2. Install *x

Step 3. Install LiveTex

Step 4. Breathe