Tex-Filtering

Tex-Filtering

by Lars Bücken -
Number of replies: 7
I have a peck of trouble with the tex-filtering. Neither the mimetex.exe nor the optional binaries (latex, dvips, convert) are working. I already searched the whole forum (for example the hints for running the tex-filter with Windows Server 2003) and tested the hints given, but there was no improvement.

We use Windows Server 2008 64-Bit Sp2, Apache 2.2.11, PHP 5.2.10, MySQL 5.1, Moodle 1.9.6.

First i tried to download the newest mimetex.exe from moodle.org, then changed the user-rights for the moodledata\filter\tex-folder. No success. Then I installed Miktex and Imagemagick, inserted the pathes to latex.exe, dvips.exe and convert.exe. Green Tickmarks appeared...but no formula-gifs.

The only thing which works is that .tex-files are generated in the moodledata\tmp\latex.


Here is the output from the Tex Filter Debugger (texdebug.php)

1) [See the cache_filters database entry for this expression (if any)]
DB cache_filters entry for f(x)=\\Bigint_{-\\infty}^x~e^{-t^2}dt not found

3) [Show a graphic image of the algebraic expression rendered with mimetex]
Der Befehl "C:\Program Files " ist entweder falsch geschrieben oder konnte nicht gefunden werden.
The shell command
C:\Program^ Files^ (x86)\Apache^ Software^ Foundation\Apache2.2\htdocs\moodle/filter/tex/mimetex.exe ++ -e "C:\Program Files (x86)\Apache Software Foundation\Apache2.2/moodledata/filter/tex/d1e56126337cd6e29b16fe759232ce90.gif" -- "\Large f(x)=\\Bigint_{-\\infty}^x~e^{-t^2}dt"
returned status = 1
File size of mimetex executable C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\moodle/filter/tex/mimetex.exe is 943027
The file permissions are: 100777
The md5 checksum of the file is 8bb2d0687c94dcecee38fc241db5f565
Image not found!

No text output available

4) [Show a graphic image of the algebraic expression rendered with Tex/Ghostscript]
Warning: filemtime() [function.filemtime]: stat failed for C:\Program Files (x86)\Apache Software Foundation\Apache2.2/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\moodle\lib\filelib.php on line 672

Warning: filesize() [function.filesize]: stat failed for C:\Program Files (x86)\Apache Software Foundation\Apache2.2/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\moodle\lib\filelib.php on line 673

Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\moodle\lib\filelib.php:672) in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\moodle\lib\filelib.php on line 704

Warning: fopen(C:\Program Files (x86)\Apache Software Foundation\Apache2.2/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif) [function.fopen]: failed to open stream: No such file or directory in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\moodle\lib\filelib.php on line 987

5) [Show command execution output from the algebraic expression rendered with Tex/Ghostscript]
Checking executables
latex executable (C:\Program Files (x86)\MiKTeX 2.8\miktex\bin\latex.exe) is readable
dvips executable (C:\Program Files (x86)\MiKTeX 2.8\miktex\bin\dvips.exe) is readable
convert executable (C:\Program Files\ImageMagick-6.5.7-Q16\convert.exe) is readable

base filename for expression is 'd1e56126337cd6e29b16fe759232ce90'

Processing TeX expression:

f(x)=\Bigint_{-\infty}^x~e^{-t^2}dt

$ C:\Program Files (x86)\MiKTeX 2.8\miktex\bin\latex.exe --interaction=nonstopmode C:\Program Files (x86)\Apache Software Foundation\Apache2.2/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.tex
OUTPUT:
RETURN CODE: 1

$ "C:\Program Files (x86)\MiKTeX 2.8\miktex\bin\dvips.exe" -q -E C:\Program Files (x86)\Apache Software Foundation\Apache2.2/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.dvi
OUTPUT:
RETURN CODE: 1

$ "C:\Program Files\ImageMagick-6.5.7-Q16\convert.exe" -density 240 -trim C:\Program Files (x86)\Apache Software Foundation\Apache2.2/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.ps C:\Program Files (x86)\Apache Software Foundation\Apache2.2/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif
OUTPUT:
RETURN CODE: 1

Could anyone help me? I find it is a hard nut to crack. Thanks!
Average of ratings: -
In reply to Lars Bücken

Re: Tex-Filtering

by Mauno Korpelainen -

I installed those executables of MikTex to my local PC (Vista testbox) to

C:\MiKTeX\miktex\bin\latex.exe
C:\MiKTeX\miktex\bin\dvips.exe
C:\ImageMagick\convert.exe

(paths without quotes in administration of settings of TeX filter)

and gave all users full permissions to use those files (in fact all files of MikTex and ImageMagick)

and it seems to work ok. That RETURN CODE: 1 means that searched files are not found - Windows 2008 server did not probably allow script to create them at all.

The reason for failure could be "C:\Program Files " - Der Befehl "C:\Program Files " ist entweder falsch geschrieben oder konnte nicht gefunden werden.

Either the path (spaces?) is not accepted or some similar access control as Vista's UAC might prevent access...to C:\Program Files

In reply to Mauno Korpelainen

Re: Tex-Filtering

by Lars Bücken -
Hi Mauno,

I also gave full permissions to all files of Miktex, Imagemagick, mimetex and Moodledata-Directory where the .tex and .gif-files are processed. The main problem are the files-pathes (for example "The command 'C:\Program Files '" indicates that there is running something totally wrong, because there is no command, it is just the beginning of a file-path.). I guess the filter.php of the tex module gets its path-information from the config.php (for example the dataroot-directory) - what are the correct locations where to change the pathnames?

Thanks a lot!

Lars
In reply to Lars Bücken

Re: Tex-Filtering

by Mauno Korpelainen -

Ah - but it could as well mean that your MikTex is not installed correct...

Have you added the paths where MikTex and ImageMagick are to your Windows 2008 server system environment path? (not user environment path...)

The file paths for your commands are taken from settings of TeX filter, for example $CFG->filter_tex_pathlatex has the path to your latex executable and commands can be executed from the same directory where script is or from the folders that are in system environment PATH http://technet.microsoft.com/en-us/library/cc772047.aspx 

( I have not used Windows 2008 server but basicly it should work the same way as other servers of Microsoft )

In reply to Lars Bücken

Re: Tex-Filtering

by Mauno Korpelainen -

The other thing that is strange is that if you have given IUSER (any internet user) or all users of server permission to execute mimetex.exe and use moodledata it usually works with that single file...but we are talking about Windows here wink

If you installed MikTex with installer http://docs.miktex.org/2.8/manual/installing.html

it should have probably added all needed settings to Windows - unless you just downloaded the installer and files but did not run the actual setup program ( if I still remember it correct the install process was a two step process and took a long time )

Third thing that might have some influence is that you have Windows Server 2008 64-Bit ( not 32-Bit ) so you might have downloaded wrong installer of MikTex etc.

In reply to Mauno Korpelainen

Re: Tex-Filtering

by Lars Bücken -
Hi Mauno,

thanks for your help! It's definitly is a path problem...the texdebug.php gave the response for mimetex:
C:\Program^ Files^ (x86)\Apache^ Software^ Foundation\Apache2.2\htdocs\moodle/filter/tex/mimetex.exe ++ -e "C:\Program Files (x86)\Apache Software Foundation\Apache2.2/moodledata/filter/tex/d1e56126337cd6e29b16fe759232ce90.gif" -- "\Large f(x)=\\Bigint_{-\\infty}^x~e^{-t^2}dt"

I started a dosbox and entered the following command:
"C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\moodle/filter/tex/mimetex.exe" ++ -e "C:\Program Files (x86)\Apache Software Foundation\Apache2.2/moodledata/filter/tex/d1e56126337cd6e29b16fe759232ce90.gif" -- "\Large f(x)=\\Bigint_{-\\infty}^x~e^{-t^2}dt"

Then the .gif was correctly produced in the moodledata/filter/tex. Do you know where to put the correct path in the filter-files?
In reply to Lars Bücken

Re: Tex-Filtering

by Nils Finnsson -
Lars, did you (or anyone) find a solution to this problem?

-nils
In reply to Nils Finnsson

Re: Tex-Filtering

by Mauno Korpelainen -

I suppose the main problem was just that he used such system paths that are controlled by Windows UAC - you should install TexLive or MikTex to folders like C:\texlive or C:\miktex and not under Program Files etc (Windows system folders).

If something prevents installing or executing of this kind of applications it's usually permissions/UAC permissions or some disabled functions of php that can as well prevent execution of executable files or creating of tex images to subfolders of moodledata.