Just for the information of those folks using this approach to rendering LaTeX expressions in their boards.[unparseable or potentially dangerous latex formula]
Meaning, what? Nothing has changed on the system except an upgrade to php 5.4.0.stevem wrote:Make sure that exec is allowed.
[phpBB Debug] PHP Warning: in file [ROOT]/latexrender/class.latexrender.php on line 271: copy(25db36d1550c1f2db5a5ccc3884c84aa.gif): failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/latexrender/class.latexrender.php on line 291: unlink([ROOT]/latexrender/tmp/25db36d1550c1f2db5a5ccc3884c84aa.dvi): No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/latexrender/class.latexrender.php on line 292: unlink([ROOT]/latexrender/tmp/25db36d1550c1f2db5a5ccc3884c84aa.ps): No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/latexrender/class.latexrender.php on line 293: unlink([ROOT]/latexrender/tmp/25db36d1550c1f2db5a5ccc3884c84aa.gif): No such file or directory
Code: Select all
<?php
$cmd="ls";
exec("$cmd 2>&1", $output);
foreach($output as $outputline){
echo("$outputline<br>");
}
?>
Hmmm - not sure. Time stamp on php.ini hasn't been touched (still shows a date of 2010).stevem wrote:Upgrading PHP can often reset php.ini to the default which is to not allow exec to run, and so you won't be able to run latex. Check by running this php program:That's for Linux systems - replace ls by dir in Windows. That will tell you if exec is allowed or not. If not then you need to change php.ini to allow exec in disable_functions.Code: Select all
<?php $cmd="ls"; exec("$cmd 2>&1", $output); foreach($output as $outputline){ echo("$outputline<br>"); } ?>
Just ranstevem wrote:Upgrading PHP can often reset php.ini to the default which is to not allow exec to run, and so you won't be able to run latex. Check by running this php program:That's for Linux systems - replace ls by dir in Windows. That will tell you if exec is allowed or not. If not then you need to change php.ini to allow exec in disable_functions.Code: Select all
<?php $cmd="ls"; exec("$cmd 2>&1", $output); foreach($output as $outputline){ echo("$outputline<br>"); } ?>
Code: Select all
<?php
if(function_exists('exec')) {
echo "exec is enabled";
}
?>
Tried the first part (disable file deletion). In /tmp, I see an .aux file, a *.tex file, and a *.log. What is truly weird is what the tex file looks like:stevem wrote:Disable file deletion at the end of class.latexrender.php and check which files have been created. Then add some code into class.latexrender.php to tell you what has happened and where things have gone wrong. For example, if latex hasn't been run there will be no log file and when you execute latex use the exec("$cmd 2>&1", $output); construction to tell you what has gone wrong.
Code: Select all
\documentclass[10pt]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\pagestyle{empty}
\begin{document}
$x=y$
d{document}
stevem wrote:That's good as it might be the problem. The log file exists so latex is being run.
The new version of PHP may see \e as an escape character, so in class.latexrender.php you need to use an extra backslash. In the line
$string .= "\end{document}\n";
change it to
$string .= "\\end{document}\n";
and try again.
Next? ;-) Thanks again...[phpBB Debug] PHP Warning: in file [ROOT]/latexrender/class.latexrender.php on line 271: copy(5e07f1cda7e44b94e3f58ef5b67d5871.gif): failed to open stream: No such file or directory
Indeed, there does seem to be a *major* problem with ImageMagick. I know its installed (has been for some time). But, when I runstevem wrote:That sounds like a problem with imagemagick which converts the ps file to gif. Try converting it directly using a shell command. Rename the ps file to test.ps then see if
/usr/bin/convert -density 120 -trim -transparent "#FFFFFF" test.ps test.gif
converts correctly or if there's an error message.
I did a little digging, and the answer seems to be that the version of ImageMagick available to RHEL/CentOS 5.x machines is 'broken'. See the followingError: /undefinedfilename in (120x120)
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:1154/1684(ro)(G)-- --dict:0/20(G)-- --dict:70/200(L)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript 8.70: Unrecoverable error, exit code 1
Error: /undefinedfilename in (120x120)
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:1154/1684(ro)(G)-- --dict:0/20(G)-- --dict:70/200(L)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript 8.70: Unrecoverable error, exit code 1
convert: no decode delegate for this image format `test.ps'.
convert: Postscript delegate failed `test.ps'.
convert: missing an image filename `test.gif'.
So, downgrading to the version of ImageMagick for RHEL/CentOS 5.7 (as described in the link, in the quoted text above) did the trick. Things are now working as they did before.cooch17 wrote: I did a little digging, and the answer seems to be that the version of ImageMagick available to RHEL/CentOS 5.x machines is 'broken'. See the following
http://centos.org/modules/newbb/print.p ... SC&start=0
My machine is running said distro, and recent updates to 5.8 are probably the culprit. I'll see if I can work out a fix/workaround, and post here. So, probably is a conspiracy of two things -- the new php not handling \e (thanks for point that out), and now ImageMagick.
Confirmed. Dug into the chagelog for php 5.4.0. Found the followingstevem wrote: The new version of PHP may see \e as an escape character, so in class.latexrender.php you need to use an extra backslash. In the line
$string .= "\end{document}\n";
change it to
$string .= "\\end{document}\n";
and try again.
Bingo. So, class.latexrender.php will break with php 5.4.0, unless you add the extra backslash.Fixed bug #60350 (No string escape code for ESC (ascii 27), normally \e).