Extension talk:PhpMathPublisher alternative

Latest comment: 13 years ago by Almuhammedi in topic Rendering Problems

to use mtag.php with math tag (not <m> or <tex>) just comment out case 'math': in includes/parser/Parser.php 87.116.212.130 04:23, 14 March 2009 (UTC)Reply

Memory problems

edit

I'm trying to run this extension on a Wiki on a W2003 server. While trying a simple formula <m> 2^3</m>, the computer starts to think, and it's unable to display any page. The apache log shows

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 121896961 bytes) in E:\DHI\Wikicirta\xampplite\htdocs\Wikicirta\extensions\phpmathpublisher\mathpublisher.php on line 569 

What I did to install the phpmathpublisher is to download the file phpmathpublisher-0.3.tar.gz and untar it on the extensions folder. Then I added the phpmathpublisher.php and changed the paths in mathpublisher.php.

Where could be the problem?

Rendering Problems

edit

When I use Show Preview the Formula ist correctly rendered, but there is no effect after saving the page

(I'm using mediawiki 1.15. and the Tex math extension is also activated)


Any Idea?

I am not sure but I have the same problem and I expect that because of using short URL. If I resolve it I'll comeback here with the solution.--Almuhammedi 20:25, 21 June 2011 (UTC)Reply

I think I have a temporary solution either by fixing it in the .htaccess or in the phpmathpublisher.php file as follows:
  • Assuming you've changed your $wgScriptPath to "/w" in in LocalSettings.php; then do the same and modify the last lines in the phpmathpublisher.php file which look like:
function render_PhpMathPublisher($input, $argv, $parser = null) {
 
  if (!$parser) $parser =& $GLOBALS['wgParser'];
 
  # create/load image
  # fontsize = 14 (you can change this freely),
  # you maybe have to change the img-path to
  # "wiki/extensions/phpmathpublisher/img/" or
  # "mediawiki/extensions/phpmathpublisher/img/
  # depending on your installation
  $imgLink = mathfilter("<m>".$input."</m>",14,"extensions/phpmathpublisher/img/"); 
  # return <img> HTML-Code
  return $imgLink;

}

?>
to
function render_PhpMathPublisher($input, $argv, $parser = null) {
 
  if (!$parser) $parser =& $GLOBALS['wgParser'];
 
  # create/load image
  # fontsize = 14 (you can change this freely),
  # you maybe have to change the img-path to
  # "wiki/extensions/phpmathpublisher/img/" or
  # "mediawiki/extensions/phpmathpublisher/img/
  # depending on your installation
  $imgLink = mathfilter("<m>".$input."</m>",14,"extensions/phpmathpublisher/img/"); 
  # Fix short URL problem by replacing the same $wgScriptPath value which was set in LocalSettings.php
  $imgLink = str_replace("extensions/","/w/extensions/",$imgLink);  
  # return <img> HTML-Code
  return $imgLink;

}

?>

There, you'll find a new statement inserted:

  $imgLink = str_replace("extensions/","/w/extensions/",$imgLink);

Installation problems

edit

All done according to instructions, but error: Warning: Cannot modify header information - headers already sent by (output started at Z:\denwer\www\denwer\wiki\LocalSettings.php:1) in Z:\denwer\www\denwer\wiki\includes\WebResponse.php on line 16. :(

ereg has been DEPRECATED warning

edit

I think we should add this note to the main article since the ereg() function is used in mathpublisher.php file while it has been DEPRECATED as of PHP 5.3.0. Personally I received this error and resolved it by replacing the function ereg() everywhere in that file by the function preg_match() which is often a faster alternative. This note can be seen here on PHP website.--Almuhammedi 20:22, 21 June 2011 (UTC)Reply

Return to "PhpMathPublisher alternative" page.