User:Steel123~mediawikiwiki

I am having problem in euation editor integration with mediawiki went through all of the posts regarding that but nothing works. I have installed ImageMagick 6.3.5, ghostscript8.54, MickTex2.5

I have installed these packages

mediawiki 1.10, Apache 2.0.59, Window Server 2003, MySQL Server 5.0

my localSettings.php is following

<?php


 * 1) This file was automatically generated by the MediaWiki installer.
 * 2) If you make manual changes, please keep track in case you need to
 * 3) recreate them later.
 * 4) See includes/DefaultSettings.php for all configurable settings
 * 5) and their default values, but don't forget to make changes in _this_
 * 6) file, not there.
 * 1) file, not there.

if( defined( 'MW_INSTALL_PATH' ) ) { $IP = MW_INSTALL_PATH; } else { $IP = dirname( __FILE__ ); }
 * 1) If you customize your file layout, set $IP to the directory that contains
 * 2) the other MediaWiki files. It will be used as a base to locate files.

$path = array( $IP, "$IP/includes", "$IP/languages" ); set_include_path( implode( PATH_SEPARATOR, $path ) . PATH_SEPARATOR . get_include_path );

require_once( "includes/DefaultSettings.php" );


 * 1) If PHP's memory limit is very low, some operations may fail.
 * 2) ini_set( 'memory_limit', '20M' );

if ( $wgCommandLineMode ) { if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) { die( "This script must be run from the command line\n" ); } }
 * 1) Uncomment this to disable output compression
 * 2) $wgDisableOutputCompression = true;

$wgSitename        = "FalconWiki";

$wgScriptPath      = "/mediawiki";
 * 1) The URL base path to the directory containing the wiki;
 * 2) defaults for all runtime URL paths are based off of this.


 * 1) For more information on customizing the URLs please see:
 * 2) http://www.mediawiki.org/wiki/Manual:Short_URL

$wgEnableEmail     = true; $wgEnableUserEmail = true;

$wgEmergencyContact = "james.majczek@ngc.com"; $wgPasswordSender = "james.majczek@ngc.com";

$wgEnotifUserTalk = true; # UPO $wgEnotifWatchlist = true; # UPO $wgEmailAuthentication = true;
 * 1) For a detailed description of the following switches see
 * 2) http://meta.wikimedia.org/Enotif and http://meta.wikimedia.org/Eauthent
 * 3) There are many more options for fine tuning available see
 * 4) /includes/DefaultSettings.php
 * 5) UPO means: this is also a user preference option

$wgDBtype          = "mysql"; $wgDBserver        = "localhost"; $wgDBname          = "wikidb"; $wgDBuser          = "wikiuser"; $wgDBpassword      = "wikiadmin"; $wgDBport          = "5432"; $wgDBprefix        = "";

$wgDBTableOptions  = "TYPE=InnoDB";
 * 1) MySQL table options to use during installation or update

$wgDBmwschema      = "mediawiki"; $wgDBts2schema     = "public";
 * 1) Schemas for Postgres

$wgDBmysql5 = false;
 * 1) Experimental charset support for MySQL 4.1/5.0.

$wgMainCacheType = CACHE_NONE; $wgMemCachedServers = array;
 * 1) Shared memory settings


 * 1) To enable image uploads, make sure the 'images' directory
 * 2) is writable, then set this to true:

$wgEnableUploads      = true; $wgUseImageMagick = true; $wgImageMagickConvertCommand = "C:\Program Files\ImageMagick-6.3.5-Q16\Convert.exe";


 * 1) If you want to use image uploads under safe mode,
 * 2) create the directories images/archive, images/thumb and
 * 3) images/temp, and make them all writable. Then uncomment
 * 4) this, if it's not already uncommented:
 * 5) $wgHashedUploadDirectory = true;

$wgUseTeX= true; $wgTexvc="C:\Program Files\Apache Group\Apache2\htdocs\mediawiki\math\texvc.exe"; $wgLocalInterwiki  = $wgSitename;
 * 1) If you have the appropriate support software installed
 * 2) you can enable inline LaTeX equations:

$wgLanguageCode = "en";

$wgProxyKey = "57d7d1c43ac14db566397aa420328e7cfc7f47766e7062670995426be5450d";

$wgDefaultSkin = 'monobook';
 * 1) Default skin: you can change the default skin. Use the internal symbolic
 * 2) names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':

$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright $wgRightsUrl = ""; $wgRightsText = ""; $wgRightsIcon = "";
 * 1) For attaching licensing metadata to pages, and displaying an
 * 2) appropriate copyright notice / icon. GNU Free Documentation
 * 3) License and Creative Commons licenses are supported so far.
 * 4) $wgEnableCreativeCommonsRdf = true;
 * 1) $wgRightsCode = ""; # Not yet used

$wgDiff3 = "";

$configdate = gmdate( 'YmdHis', @filemtime( __FILE__ ) ); $wgCacheEpoch = max( $wgCacheEpoch, $configdate ); $wgEnableUploads=true; $wgLogo="http://LocalHost/mediawiki/images/a/aa/F-16_Block_60.JPG"; include_once('http://LocalHost/mediawiki/extensions/latex.php');
 * 1) When you make changes to this configuration file, this will make
 * 2) sure that cached pages are cleared.
 * 1) require_once( 'extensions/equationeditor.php' );
 * 1) $sfgNamespaceIndex = 150;

$wgMathPath="C:\Program Files\Apache Group\Apache2\htdocs\mediawiki\math"; $wgTmpDirectory="C:\Program Files\Apache Group\Apache2\htdocs\mediawiki\images\temp"; $wgInputEncoding='iso-8859-1'; $wgImageMagickIdentifyCommand = "C:\Program Files\ImageMagick-6.3.5-Q16\Identify.exe"; $wgLaTexCommand="C:\MiKTeX2.5\miktex\bin\latex.exe"; $wgDvipsCommand="C:\MiKTeX2.5\miktex\bin\dvips.exe"; $wgDebugLogFile="C:\wiki.log"; $wgDebugMathLogFile="C:\debug.log.txt";
 * 1) include_once('extensions/SemanticForms/includes/SF_Settings.php');
 * 2) include_once('http://LocalHost/mediawiki/extensions/SemanticMediaWiki/includes/SMW_Settings.php');
 * 3) enableSemantics('LocalHost');
 * 1) $wgMathDirectory="C:\Program Files\Apache Group\Apache2\htdocs\mediawiki\images\Math";

Here is my render.ml let cmd_dvips tmpprefix = "dvips -R -E -q \"" ^ tmpprefix ^ ".dvi\" -f >\"" ^tmpprefix^".ps\" " let cmd_latex tmpprefix = "latex -quiet \"" ^ tmpprefix ^ ".tex\" >\""^tmpprefix^".tmp\" " let cmd_convert tmpprefix finalpath = "convert -quality 100 -density 120 \"ps:"^tmpprefix^".ps\" \""^finalpath^"\"" exception ExternalCommandFailure of string let render tmppath finalpath outtex md5 = let tmpprefix0 = (string_of_int (Unix.getpid ))^"_"^md5 in  let tmpprefix = (tmppath^"\\"^tmpprefix0) in   let unlink_all  = begin Sys.remove (tmpprefix ^ ".dvi"); Sys.remove (tmpprefix ^ ".aux"); Sys.remove (tmpprefix ^ ".log"); Sys.remove (tmpprefix ^ ".tex"); Sys.remove (tmpprefix ^ ".ps"); Sys.remove (tmpprefix ^ ".tmp"); end in  let f = (Util.open_out_unless_exists (tmpprefix ^ ".tex")) in     begin output_string f (Texutil.get_preface ); output_string f outtex; output_string f (Texutil.get_footer ); close_out f;      if Util.run_in_other_directory tmppath (cmd_latex tmpprefix0) != 0 then (unlink_all ; raise (ExternalCommandFailure "latex")) else if (Sys.command (cmd_dvips tmpprefix) != 0) then (unlink_all ; raise (ExternalCommandFailure "dvips")) else if (Sys.command (cmd_convert tmpprefix (finalpath^"\\"^md5^".png")) != 0) then (unlink_all ; raise (ExternalCommandFailure "convert")) else unlink_all end

Here is my Math.php

<?php /** * Contain everything related to $$ $$ parsing */

/** * Takes LaTeX fragments, sends them to a helper program (texvc) for rendering * to rasterized PNG and HTML and MathML approximations. An appropriate * rendering form is picked and returned. * * by Tomasz Wegrzanowski, with additions by Brion Vibber (2003, 2004) * */ class MathRenderer { var $mode = MW_MATH_MODERN; var $tex = ''; var $inputhash = ''; var $hash = ''; var $html = ''; var $mathml = ''; var $conservativeness = 0;

function __construct( $tex ) { $this->tex = $tex; }

function setOutputMode( $mode ) { $this->mode = $mode; }

function render { global $wgTmpDirectory, $wgMathDirectory, $wgInputEncoding; global $wgTexvc; $fname = 'MathRenderer::render';

if( $this->mode == MW_MATH_SOURCE ) { # No need to render or parse anything more! return ('$ '.htmlspecialchars( $this->tex ).' $'); }		if( $this->tex == '' ) { return; # bug 8372 }

if( !$this->_recall ) { # Ensure that the temp and output directories are available before continuing... if( !file_exists( $wgTmpDirectory ) ) { if( !@mkdir( $wgTmpDirectory ) ) { return $this->_error( 'math_bad_tmpdir' ); }			} elseif( !is_dir( $wgTmpDirectory ) || !is_writable( $wgTmpDirectory ) ) { return $this->_error( 'math_bad_tmpdir' ); }

if( function_exists( 'is_executable' ) && !is_executable( $wgTexvc ) ) { return $this->_error( 'math_notexvc' ); }			$cmd = $wgTexvc. ' ' .					escapeshellarg( $wgTmpDirectory ).' '. escapeshellarg( $wgMathDirectory ).' '. escapeshellarg( $this->tex ).' '. escapeshellarg( $wgInputEncoding );

#if ( wfIsWindows ) { # Invoke it within cygwin sh, because texvc expects sh features in its default shell #$cmd = 'sh -c '. wfEscapeShellArg( $cmd ); #}

$cmd=str_replace("/","\\",$cmd);

wfDebug( "TeX: $cmd\n" ); $contents = `$cmd`; wfDebug( "TeX output:\n $contents\n---\n" );

if (strlen($contents) == 0) { return $this->_error( 'math_unknown_error' ); }

$retval = substr ($contents, 0, 1); $errmsg = ''; if (($retval == 'C') || ($retval == 'M') || ($retval == 'L')) { if ($retval == 'C') { $this->conservativeness = 2; } else if ($retval == 'M') { $this->conservativeness = 1; } else { $this->conservativeness = 0; }				$outdata = substr ($contents, 33);

$i = strpos($outdata, "\000");

$this->html = substr($outdata, 0, $i); $this->mathml = substr($outdata, $i+1); } else if (($retval == 'c') || ($retval == 'm') || ($retval == 'l')) { $this->html = substr ($contents, 33); if ($retval == 'c') { $this->conservativeness = 2; } else if ($retval == 'm') { $this->conservativeness = 1; } else { $this->conservativeness = 0; }				$this->mathml = NULL; } else if ($retval == 'X') { $this->html = NULL; $this->mathml = substr ($contents, 33); $this->conservativeness = 0; } else if ($retval == '+') { $this->html = NULL; $this->mathml = NULL; $this->conservativeness = 0; } else { $errbit = htmlspecialchars( substr($contents, 1) ); switch( $retval ) { case 'E': $errmsg = $this->_error( 'math_lexing_error', $errbit ); case 'S': $errmsg = $this->_error( 'math_syntax_error', $errbit ); case 'F': $errmsg = $this->_error( 'math_unknown_function', $errbit ); default: $errmsg = $this->_error( 'math_unknown_error', $errbit ); }			}

if ( !$errmsg ) { $this->hash = substr ($contents, 1, 32); }

wfRunHooks( 'MathAfterTexvc', array( &$this, &$errmsg ) );

if ( $errmsg ) { return $errmsg; }

if (!preg_match("/^[a-f0-9]{32}$/", $this->hash)) { return $this->_error( 'math_unknown_error' ); }

if( !file_exists( "$wgMathDirectory/{$this->hash}.png" ) ) { return $this->_error( 'math_image_error' ); }

$hashpath = $this->_getHashPath; if( !file_exists( $hashpath ) ) { if( !@wfMkdirParents( $hashpath, 0755 ) ) { return $this->_error( 'math_bad_output' ); }			} elseif( !is_dir( $hashpath ) || !is_writable( $hashpath ) ) { return $this->_error( 'math_bad_output' ); }

if( !rename( "$wgMathDirectory/{$this->hash}.png", "$hashpath/{$this->hash}.png" ) ) { return $this->_error( 'math_output_error' ); }

# Now save it back to the DB: if ( !wfReadOnly ) { $outmd5_sql = pack('H32', $this->hash);

$md5_sql = pack('H32', $this->md5); # Binary packed, not hex

$dbw = wfGetDB( DB_MASTER ); $dbw->replace( 'math', array( 'math_inputhash' ),				 array( 'math_inputhash' => $md5_sql, 'math_outputhash' => $outmd5_sql, 'math_html_conservativeness' => $this->conservativeness, 'math_html' => $this->html, 'math_mathml' => $this->mathml, ), $fname, array( 'IGNORE' )				); }

}

return $this->_doRender; }

function _error( $msg, $append = '' ) { $mf  = htmlspecialchars( wfMsg( 'math_failure' ) ); $errmsg = htmlspecialchars( wfMsg( $msg ) ); $source = htmlspecialchars( str_replace( "\n", ' ', $this->tex ) ); return "$mf ($errmsg$append): $source \n"; }

function _recall { global $wgMathDirectory; $fname = 'MathRenderer::_recall';

$this->md5 = md5( $this->tex ); $dbr = wfGetDB( DB_SLAVE ); $rpage = $dbr->selectRow( 'math',			array( 'math_outputhash','math_html_conservativeness','math_html','math_mathml' ),			array( 'math_inputhash' => pack("H32", $this->md5)), # Binary packed, not hex			$fname		);

if( $rpage !== false ) { # Tailing 0x20s can get dropped by the database, add it back on if necessary: $xhash = unpack( 'H32md5', $rpage->math_outputhash . "               " ); $this->hash = $xhash ['md5'];

$this->conservativeness = $rpage->math_html_conservativeness; $this->html = $rpage->math_html; $this->mathml = $rpage->math_mathml;

if( file_exists( $this->_getHashPath. "/{$this->hash}.png" ) ) { return true; }

if( file_exists( $wgMathDirectory. "/{$this->hash}.png" ) ) { $hashpath = $this->_getHashPath;

if( !file_exists( $hashpath ) ) { if( !@wfMkdirParents( $hashpath, 0755 ) ) { return false; }				} elseif( !is_dir( $hashpath ) || !is_writable( $hashpath ) ) { return false; }				if ( function_exists( "link" ) ) { return link ( $wgMathDirectory . "/{$this->hash}.png",							$hashpath . "/{$this->hash}.png" ); } else { return rename ( $wgMathDirectory . "/{$this->hash}.png",							$hashpath . "/{$this->hash}.png" ); }			}

}

# Missing from the database and/or the render cache return false; }

/**	 * Select among PNG, HTML, or MathML output depending on	 */ function _doRender { if( $this->mode == MW_MATH_MATHML && $this->mathml != '' ) { return ""; }		if (($this->mode == MW_MATH_PNG) || ($this->html == '') ||		  (($this->mode == MW_MATH_SIMPLE) && ($this->conservativeness != 2)) ||		   (($this->mode == MW_MATH_MODERN || $this->mode == MW_MATH_MATHML) && ($this->conservativeness == 0))) { return $this->_linkToMathImage; } else { return ' '.$this->html.' '; }	}

function _linkToMathImage { global $wgMathPath; $url = htmlspecialchars( "$wgMathPath/" . substr($this->hash, 0, 1)					.'/'. substr($this->hash, 1, 1) .'/'. substr($this->hash, 2, 1)					. "/{$this->hash}.png" ); $alt = trim(str_replace("\n", ' ', htmlspecialchars( $this->tex ))); return ""; }

function _getHashPath { global $wgMathDirectory; $path = $wgMathDirectory .'/'. substr($this->hash, 0, 1) .'/'. substr($this->hash, 1, 1) .'/'. substr($this->hash, 2, 1); wfDebug( "TeX: getHashPath, hash is: $this->hash, path is: $path\n" ); return $path; }

public static function renderMath( $tex ) { global $wgUser; $math = new MathRenderer( $tex ); $math->setOutputMode( $wgUser->getOption('math')); return $math->render; } } ?>

I would really appreciate if I can get some help thanks