Okay, I've found a workaround. So if you cannot use system calls on your system, replace all the lines inside the $do_latex loop as follows:
Code:
if($do_latex) {
$mimetex_formula = $tex_matches[1][$i];
$text = substr_replace($text, "<img src='".$cgi_path."?".$mimetex_formula."' alt='".htmlentities($mimetex_formula, ENT_QUOTES)."' align=absmiddle>",$pos,strlen($tex_matches[0][$i]));
}
Where $cgi_path is defined at the top as:
Code:
$cgi_path = "http://yourdomain/cgi-bin/mimetex.cgi";
There are no images stored with this method, so some could be trimmed down from the initial php code too.
edit: cleaned up the img tag a bit.