Manual talk:Running MediaWiki on Windows

Files Paths
You're probably right when sayin Tex is "somewhat troublesome" :) I think i set up everything correct, as it is explained in this article, but I'm not sure about the correct program paths and their content. Are the following paths correct??? (assuming C:\...\htdocs\dewiki\ is my mediawiki main folder)


 * dewiki\latex: I just copied the miktex\bin of my miktex-installation and renamed it to "latex", because latex.exe is in there.


 * dewiki\dvips: I copied it from the mainfolder of my miktex-installation. In dvips are 15 subfolders, no executable, right?


 * dewiki\convert: I installed ImageQuick to dewiki\ImageMagick and renamed the ImageMagick folder to "convert". convert.exe is in there.

In this discussion below is mention that Ghostscript is required. So i installed it to
 * dewiki\gs: subfolder of gs are fonts/gs8.50! do i have to put the content of gs\gs8.50\bin into dewiki\gs instead?

Furthermore im not sure about the render.ml in the "math" folder. Is the following end of the file correct?

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

Last question: Does PHP's "Safe Mode" has to be turned off to get Tex to work? Does it matter?

Texvc for Windows
I think I'm quite there...Can someone help me, please? I have mediawiki 1.8.2 and I'm trying to install math support. I followed all the instructions to install Mathematics support, in this page ( 1ª option ):
 * The commands gs, latex, dvips and convert work properly in command line
 * The command texvc \tmp \math \sqrt{2} utf-8 generates the respective .png
 * When I try to use $$\sqrt{2}$$ in a wiki page:
 * The image\tmp directory is generated, but with no file .png
 * The image\math directory is not generated
 * I get a error in the wiki page: Failed on verifying gramatics (unknown error): \sqrt{2}
 * I tried every sugestion in this page and could'nt solve the problem. What am I doing wrong ?

Thanks, Vences 18:38, 31 January 2007 (UTC)

Anyone care to make a Windows texvc executable available for those of us who can't get it together to build their own?

By the way, texvc produces slashes (/) in filenames, which results in errors on windows. Cannot get any formula rendered.

Look for GlagTeX or MiKTeX they have binaries of TeX --WR 21:42, 8 Mar 2005 (UTC)

You can compile texvc if you have cygwin installed.

Or install MinGW to compile texvc. just type "make" Kornelius 08:19, 14 January 2007 (UTC)

Here's one that I just compiled under cygwin from texvc's 20050202 release that seems to work well enough (for texvc, that is). Could someone else please host it?

One note, though - I had to tweak the very last modification. Instead of inserting

$wgTexvc = "texvc"; # Location of the texvc binary

into localSettings.php after placing the .exe into the base directory, you should instead insert

$wgTexvc = ".\\texvc.exe"; # Location of the texvc binary

because, remember, it's under Windows. --Mcarlisle 00:20, 24 Apr 2005 (UTC)

I've added another windows binary, this one for native Win32 without Cygwin. It's based on MediaWiki 1.4.7 and uses the modifications to the render.ml I posted in the page. By the way, I'd suggest to remove all the explanation of the process and just give the render.ml patch directly. --Fernando 08:24, 7 August 2005 (UTC)

Nothing happens
When i've run the config/index.php (successfully) i'm told to move the LocalSettings.php to the parent directory (the one where index.php is, as i've understood it). When i've done that, the index.php should work. But when I click on the link to index.php, I only get a page telling me that the index.php could not be shown (the usual error 404 message). When I look at the php-files (index.php and LocalSettings.php) there seems to be something strange with the includes. For example, in index.php (in the parent directory) there are lots of include_once like: include_once( "Setup.php" ); Setup.php is located in the includes folder and should be included with: include_once( "//includes/Setup.php" ); This maybe isn't the problem, I'm just a PHP amateur, but has someone else encountered this problem and knows how to resolve it? (I have mediawiki-1.2.6 running on Apache, PHP and MySql)

Can't edit
I've installed Apache, MySQL, PHP and MediaWiki on my PC and it all nearly seems to be working. When I browse to wiki.phtml I get the main page with the menus but I can't edit it or go to any of the special pages, I always get taken back to the main page (which is empty). Anyone got any ideas? Mintguy 07:06, 22 Nov 2003 (UTC)


 * The reason it wasn't working was because I hadn't modified the php.ini file with register_globals = On. Mintguy


 * Also look for multiple copies of php.ini in your harddisk. Mine didn't start until I found that the right php.ini where to enable register_globals was the one inside c:\windows, NOT the one in the default php directory. At18 22:23, 8 Dec 2003 (UTC)

Getting sysop rights?
Hi

@first: sorry for my bad language ;)

I've installed MediaWiki on an WAMP-PC ... I wanted to log in as Sysop - but i don't have a password for this User (Do not find this also anywhere) ... Then i've register a new user - this works fine - but no Admin-Rights ;)

Where can i find the Sys-OP-Default-PW?

Thx Patrick


 * See Setting user rights in MediaWiki. --Brion VIBBER 01:11, 6 Dec 2003 (UTC)

Wrong DB?
The instructions on this page say one should enter "use wikipedia" before sourcing the dump. Shouldn't that read "use wikidb" instead? -- Finlay McWalter 23:00, 19 Jan 2004 (UTC)

Download Help
I cant seem to find the Win32 download for Mediawiki. It seems only the Linux version exists at http://sourceforge.net/projects/wikipedia/


 * There is no such thing as a Linux version or Win32 version of MediaWiki. It's written in cross-platform PHP and ought to run unchanged on Linux, Unix, MacOS X, Windows, and any other platform that Apache+PHP run on. --Brion VIBBER 06:33, 28 Feb 2004 (UTC)

Install Help
When I try to use "c:\php\php c:\mediawiki\install.php" to instill mediawiki, there are lots of Warning and Notice appears. Here are all the Warnings and Notices:
 * PHP Notice: Undefined variable:  REQUEST_METHOD in C:\myweb\wiki\Setup.php on line 74
 * PHP Notice: Undefined variable:  REQUEST_URI in C:\myweb\wiki\Setup.php on line 74
 * PHP Warning: mysql_select_db: supplied argument is not a valid MySQL-Link resource in C:\myweb\wiki\Database.php on line 387
 * PHP Warning: mysql_query: supplied argument is not a valid MySQL-Link resource in C:\myweb\wiki\Database.php on line 165
 * PHP Notice: Undefined variable:  sysop_password in c:\mediawiki\install.php on line 199
 * PHP Warning: mysql_num_rows: supplied argument is not a valid MySQL result re source in C:\myweb\wiki\Database.php on line 190
 * PHP Warning: mysql_free_result: supplied argument is not a valid MySQL result  resource in C:\myweb\wiki\Database.php on line 188
 * PHP Warning: mysql_num_rows: supplied argument is not a valid MySQL result resource in C:\myweb\wiki\Database.php on line 190
 * PHP Notice: Undefined variable:  developer_password in c:\mediawiki\install.php on line 222
 * PHP Notice: Undefined variable:  sysop_password in c:\mediawiki\install.php on line 199
 * PHP Notice: Undefined index:  unprotectedarticle in C:\myweb\wiki\LanguageZh.php on line 1063
 * PHP Notice: Undefined index:  uploaddisabled in C:\myweb\wiki\LanguageZh.php on line 1063
 * PHP Notice: Undefined index:  userstatstext in C:\myweb\wiki\LanguageZh.php on line 1063
 * PHP Notice: Undefined index:  viewsource in C:\myweb\wiki\LanguageZh.php on line 1063
 * PHP Notice: Undefined index:  wlsaved in C:\myweb\wiki\LanguageZh.php on line 1063
 * PHP Notice: Undefined index:  wlshowlast in C:\myweb\wiki\LanguageZh.php on line 1063
 * PHP Notice: Undefined index:  wrong_wfQuery_params in C:\myweb\wiki\LanguageZh.php on line 1063
 * PHP Notice: Undefined property:  mContainsNewMagic in C:\myweb\wiki\Parser.php on line 894

What should I do to correct this? And in my LocalSettings.php:
 * $wgSitename        = "abc";
 * $wgServer          = "http://abc.3322.org";
 * $wgScriptPath	   = "/wiki";
 * $wgScript          = "{$wgScriptPath}/index.php";
 * $wgRedirectScript  = "{$wgScriptPath}/redirect.php";
 * $wgArticlePath     = "{$wgScript}/$1";
 * $wgStyleSheetPath  = "{$wgScriptPath}/style";
 * $wgStyleSheetDirectory = "{$IP}\\style";
 * $wgUploadPath      = "{$wgScriptPath}/upload";
 * $wgUploadDirectory	= "{$IP}\\upload";
 * $wgLogo				= "{$wgUploadPath}/wiki.png";
 * $wgTmpDirectory    = "{$IP}\\tmp";

When I try to access Http://abc.3322.org/wiki/index.php, the first page is OK, but when I try to Edit this page, lots of errors appear.


 * Your PHP error reporting setting is too high; MediaWiki 1.1 and 1.2 arent' designed to run with E_NOTIFY. Turn that off. --Brion VIBBER 19:33, 16 Mar 2004 (UTC)
 * I set "E_ALL & ~( E_NOTICE | E_WARNING )" in php.ini, and restart apache, there are still warnings when editing a page, why?


 * I tried using In-place web install of mediawiki-1.2.0rc4.tar.gz, the result is just the same: first page is OK ,but when i try to Edit, lots of errors:


 * Warning: session_start: open(/tmp\sess_8a26c9ebf7916ba31859bb7056e26b2a, O_RDWR) failed: No such file or directory (2) in C:\myweb\mediawiki\includes\User.php on line 146
 * Warning: session_start: Cannot send session cookie - headers already sent by (output started at C:\myweb\mediawiki\includes\User.php:146) in C:\myweb\mediawiki\includes\User.php on line 146
 * Warning: session_start: Cannot send session cache limiter - headers already sent (output started at C:\myweb\mediawiki\includes\User.php:146) in C:\myweb\mediawiki\includes\User.php on line 146
 * Warning: Cannot modify header information - headers already sent by (output started at C:\myweb\mediawiki\includes\User.php:146) in C:\myweb\mediawiki\includes\OutputPage.php on line 176
 * Warning: Cannot modify header information - headers already sent by (output started at C:\myweb\mediawiki\includes\User.php:146) in C:\myweb\mediawiki\includes\OutputPage.php on line 210
 * Warning: Cannot modify header information - headers already sent by (output started at C:\myweb\mediawiki\includes\User.php:146) in C:\myweb\mediawiki\includes\OutputPage.php on line 211
 * Warning: Cannot modify header information - headers already sent by (output started at C:\myweb\mediawiki\includes\User.php:146) in C:\myweb\mediawiki\includes\OutputPage.php on line 212
 * Warning: Cannot modify header information - headers already sent by (output started at C:\myweb\mediawiki\includes\User.php:146) in C:\myweb\mediawiki\includes\OutputPage.php on line 213
 * Warning: Cannot modify header information - headers already sent by (output started at C:\myweb\mediawiki\includes\User.php:146) in C:\myweb\mediawiki\includes\OutputPage.php on line 253
 * Warning: Cannot modify header information - headers already sent by (output started at C:\myweb\mediawiki\includes\User.php:146) in C:\myweb\mediawiki\includes\OutputPage.php on line 254


 * what can I do? Help!!


 * Your PHP is misconfigured; change session.save_path to a path that exists, like c:\windows\temp (?) --Brion VIBBER 22:35, 16 Mar 2004 (UTC)


 * yes, that's right! Thanks

Blank Pages on Initial Install
I can't get anything but a blank page to pull up. Windows 2K3 config. Checking everything so far I can't figure out why I get blank output.
 * FYI I have tried turning debug mode on in PHP and still no results...
 * I have the same thing: linux(debian)...only a blank page, it's driving me batty, and soon to another wiki :(
 * Ditto here with LAMP installed and functioning otherwise correctly on Fedora Core 2.
 * Same here / LAMP (PHP 4.3.8) and blank pages for everything but the start page
 * To prevent blank pages on install, write this: 'while (@ob_end_flush);' in config/index.php after 'header(...' (line 21 in mediawiki 1.3.9) --Strang 14:56, 18 Dec 2004 (UTC)
 * This solution worked on OAMP with 3.6 packages (www.openbsdsupport.org). Now errors can be seen!

MySQL Errors when installing MediaWiki
Hi,

I'm having some problemsn when installing MediaWiki on Windows. It seems that the creation of the wikidb does not work. I get the following errors :

MySQL root password (typing will be visible): xxxxxx Creating database... PHP Warning: mysql_query: supplied argument is not a valid MySQL-Link resource in d:\progra~1\apache~1\apache2\htdocs\wiki\Database.php on line 165 PHP Warning: mysql_query: supplied argument is not a valid MySQL-Link resource in d:\progra~1\apache~1\apache2\htdocs\wiki\Database.php on line 165

After that the following errors are displayed after answering the 2 questions...

PHP Warning: mysql_query: supplied argument is not a valid MySQL-Link resource in d:\progra~1\apache~1\apache2\htdocs\wiki\Database.php on line 165 ... I installed the stable MySQL database version 4.0.18 on apache 2.0.47 with php 4.3.2 Any ideas ??? thanks in advance


 * You have no connection to your DB. This can have many causes. One of them can be in new authentication algorithm in MySQL 4. Read link this to solve that problem. Another can be in invalid login/password or MySQL daemon config. --Strang 15:08, 18 Dec 2004 (UTC)

Installing Problems: DB connection error: Unknown error (localhost)
Hi, I have the following problem installing MediaWiki on a Windows as well on a Linux system.

After the setup script has build up the database and so on it stops with an error message:

Generating configuration file...

Database type: MySQL

Loading class: DatabaseMysql

Attempting to connect to database server as root...success.

Connected to 5.0.22-community-nt

Created database wikidb

Creating tables... using MySQL 4 table defs... done.

Initializing data...

Granting user permissions to wiki on wikidb...success.

DB connection error: Unknown error (localhost)

Has anybody an idea what goes wrong there? Thank you in advance.

Marcus

No Database connect, error message lacking
I have gotten MediaWiki to install on Windows 98, I am running the Uniserver 1.3 which provides Apache, PHP and MySql.

The MediaWiki installer did create the databases and tables as PHPAdmin shows them present, but when I go to the default page and it (implicitly) runs index.php, all I get is the cryptic error message


 * Sorry! The wiki is experiencing some technical difficulties, and cannot contact the database server.

I'm not sure exactly what is wrong, is there a way to get more information so it can tell me why it can't connect?

Strage brackets after instlation
Hi to all

I instaled Wiki pedia in W2K3 everything works. Except TEX and some strange bug on the pages

TEX problem: I instaled all the software mentioned in the guide (Ming, OCalm, Miktex, ImageMagic), edited that file. but when I try to make such error pops up: ocamlopt -c util.ml 'as' is not recognized as an internal or external command, operable program or batch file. Assembler error, input left in file C:\DOCUME~1\edvardas\LOCALS~1\Temp\camlasm78 7bc9.s mingw32-make.exe: *** [util.cmx] Error 2 maybe someone has already compiled version of the math file for windows???
 * response : compiling with optimized caml requires you to have Microsoft assembler 6.11 or later and Visual studio C++ 6.0 installed, this is why you have an assembly error, you have three solutions:
 * install Visual c++ and MASM and compile
 * use the non optimized (interpreted bytecode) version instead, by typing mingw32-make texvc.bc, texvc.bc is an executable, so rename it to texvc.exe, and continue as if this were the normal version. The performance hit should not be too high, as it is latex and convert that takes most of the processing time
 * contact me at feza DOT gy AT laposte DOT net, and ask me for either version 82.66.120.34 21:42, 16 Jul 2004 (UTC)

MArkup bug or something: on every page I see something similar to this: Featured article

Selected anniversaries I dont see a list of topics i can find a topic only using search function. How to fix it???

Thank you in advance Edvardas Rimkus rimkus@ik.ku.lt

Using EasyPHP
Anyone done a Windows install using EasyPHP instead of separately installing MySQL, PHP, and Apache? This is described in the TikiWiki documentation at:

http://doc.tikiwiki.org/tiki-index.php?page_ref_id=10


 * Yes, I followed the instructions on the article page (as at today's date) and it worked perfectly first time. This is the first time I have ever had any MediaWiki install actually work first time without problems. Tannin 00:10, 3 Apr 2005 (UTC)

Some source which might help
I couldn't get Tex runnig at all, so I just hacked around in the math directory in the render.ml-file.

I found out texvc couldn't find/create the necessary files, due to the unix/win differences in pathes: a unix-path looks like /user/home/blabla, while a windows path looks like c:\windows\sucks. There seemed to be some parts where there are slashes instead of backslashes in the "quick and dirty" hack on this page. After some trials I got to the following:

let cmd_dvips tmpprefix = "dvips -R -E -q \"" ^ tmpprefix ^ ".dvi\" -f >\"" ^tmpprefix^".ps\" " let cmd_latex tmpprefix = "latex -quiet \"" ^ tmpprefix ^ ".tex\" " 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

In addition to replacing the two left "/" with "\\" I deleted the output pipe for the latex-call, which seemed to produce problems.

Please note, that I made this by trial and error. It seems to work, but maybe it will won't in the future or with your computer.

Have fun wikiing!

Norman Hilbert

Hi Norman,

I think this is a very good addon to the hack in the main page. The forward slashes in paths do work on win2k, but I hadn't thought about other windows versions. Would you mind merging your changes in the code in the main page ?

82.66.120.34 23:54, 2 Oct 2004 (UTC)

How to view images
I am new to Wikipedia. I have installed it locally (usign EasyPHP) and the basic stuff is working. I have downloaded the en-commons images and un-bundled the tgz files in the images directory. I am not abel to see the images. How do I enable the image display?

Thanks, Deepak

Nothing happens II
After having clicked the "Install"-Button at the bottom of config.php, I get a blank site. When I reload the blank page, I get the following message (I only post the last line:) There are already MediaWiki tables in this database. Checking if updates are needed... At the bottom of the page an additional error message is given out: Updating ipblocks table... Query "ALTER TABLE ipblocks ADD ipb_auto tinyint(1) NOT NULL default '0', ADD ipb_id int(8) NOT NULL auto_increment, ADD PRIMARY KEY (ipb_id)" failed with error code "Table 'mediwiki7.ipblocks' doesn't exist". Thanks in advance for every reply!

I am having the same problem, with media wiki 1.3.9. Running MySQL server 4.1 When I look the db using the console there are no tables in the wikidb.

Nothing happens III
I'm trying to install mediawiki-1.3.9 xampp 1.4.10a for Windows (XP SP 2) and have exactly the same problem. The wikidb was created but there's no ipblocks table. Can anyone help with this?

Hi, I'm also having the same problem I installed EasyPHP in Windows (XP SP 2). I got an error message in index.php as ALTER TABLE ipblocks ADD ipb_auto tinyint(1) NOT NULL default '0', ADD ipb_id int(8) NOT NULL auto_increment, ADD PRIMARY KEY (ipb_id)" failed with error code "Table 'mediwiki7.ipblocks' doesn't exist". So I created the ipblocks table manually in mysql.

Then when I tried it gave the other error message as Adding ipb_expiry field to table ipblocks...Query "UPDATE ipblocks SET ipb_expiry = date_format(date_add(ipb_timestamp,INTERVAL 1 DAY),"%Y%m%d%H%i%s") WHERE ipb_user = 0" failed with error code "".

I checked the Schema of wikidb but in the ipblocks there is no field like ipbexpiry

Please help me out. Karthik.G

Error on Wiki after configuring Texvc
I have installed Xampp 1.4.7. Now after I have configured texvc as described in the Page Running Mediawiki on Windows, I'm getting this error:

Warning: Invalid argument supplied for foreach in C:\apachefriends\xampp\htdocs\thermowiki\includes\User.php on line 90

Warning: Invalid argument supplied for foreach in C:\apachefriends\xampp\htdocs\thermowiki\includes\User.php on line 90

Warning: Invalid argument supplied for foreach in C:\apachefriends\xampp\htdocs\thermowiki\includes\User.php on line 90

Warning: array_key_exists [function.array-key-exists]: The second argument should be either an array or an object in C:\apachefriends\xampp\htdocs\thermowiki\includes\MagicWord.php on line 89 A database query syntax error has occurred. This could be because of an illegal search query (see $5), or it may indicate a bug in the software. The last attempted database query was: SELECT ss_total_views, ss_total_edits, ss_good_articles FROM site_stats WHERE ss_row_id=1 from within function "wfLoadSiteStats". MySQL returned error "1046: No Database Selected".

Now when I try to execute this query, it runs perfectly fine on MySQL prompt.

After this I tried to Stop and Start Xampp, then it gives a cannot find server error.

Then I replaced the Localsettings.php file, with the original generated file, I was able to open the Wiki page.

But again when I made the changes in LocalSettings.php file, as suggestes in the article, it again gave me the Server not found error.

Please suggest, what could be the problem. My mail ID is averma@webasto.de


 * The same problem (and message) occured on Debian Woody, when texvc was installed, and tetex (TeX distribution) was not.


 * The solution: remove $wgServer from LocalSettings

Error in parsing Math Expression
Hi I have configured texvc as described by you in Running Media Wikki on Windows. I installed MikTex as Large Installation. Then I restarted the Wiki Server but when I give a math expression and try to see a preview, then I get this error:

Failed to parse (PNG conversion failed; check for correct installation of latex, dvips, gs, and convert): I(\nu) d\nu d\Omega=\frac{2h\nu^{3}}{c^2}\frac{1}{\exp\left(\frac{h\nu}{kT}\right)-1}d\nu d\Omega

Please suggest what am I missing?

Hi, I have the same problem and i have no idea on how to solve it. Did you found a solution or is there someone who can help we?

thank you...

Hi, I used to have the same problem. In fact it seems that "gs" is not installed because this article forgets to mention it. Just install gs (GhostScript) Download it at http://prdownloads.sourceforge.net/ghostscript/ the needed file is gsxxxw32.exe where xxx is the version (currently 850)

Regards

I have the same problem. I've installed miktex, imagemagick, ghostscript and use pre-compiled texvc.exe and config the .php files as instructed.

I noticed that texvc run correctly from the command line and produce the .png file From Php look like the temporary .dvi file is created but I am not sure about others, cos they are all deleted once an error occur.

About ghostscript, is it ok to have it installed in c:\Program Files\ and how exactly it is used in texvc? as I didnt see any function call related to it.

If someone have it working on windows, please post all .php files, ect. Thank you

problem in showing formula
I have aproblem with math tags too,and I installed all the components on my windows server.I don't have any error but when I write formula it won't be shown inthe right format,for example x^2 between math tags not $$x^2$$

please help me if you have any idea

thank you        hengameh

Most likely the *.png files are being created, but are not displaying because the server can't find them. This seems to be controlled by the $wgMathDirectory variable.

I have a working setup:
 * Environment:
 * Windows XP SP2
 * XAMPP from ApacheFriends (apache2, mysql, php 5)
 * MediaWiki 1.6.3
 * Mikex (win32)
 * Ghostscript (win32)
 * ImageMagick (win32)
 * Cygwin (base, just to be sure sh.exe is available).

$wgUseTeX	       = true; $wgMathPath        = "{$wgUploadPath}/math"; $wgMathDirectory   = "{$wgUploadDirectory}/math"; $wgTmpDirectory    = "{$wgUploadDirectory}/tmp"; $wgTexvc           = "texvc.exe";
 * 1) If you have the appropriate support software installed
 * 2) you can enable inline LaTeX equations:

I ended up hard-coding the paths to convert, latex, and dvips in the 'render.ml' file to avoid problems.

A working configuration on my computer. $wgMathDirectory   = "images/math"; $wgTmpDirectory    = "images/tmp"; $wgTexvc = "math/texvc.exe";
 * Environment:
 * Windows XP SP2
 * MediaWiki 1.5.5
 * Mikex
 * GNU make, ImageMagick, OCaml, and GhostScript from cygwin
 * Use relative path instead of full path in LocalSettings.php. For example,

Error when editing LocalSettings.php
Hi,

I have installed mediawiki and it works fine. However, when I try to change the title of my site or set different access options by editing the LocalSettings.php I get error messages after saving everything and running my wiki...

Warning: Cannot modify header information - headers already sent by (output started at /var/www/web18/html/mediawiki/LocalSettings.php:1) in /var/www/web18/html/mediawiki/includes/OutputPage.php on line 351

Warning: Cannot modify header information - headers already sent by (output started at /var/www/web18/html/mediawiki/LocalSettings.php:1) in /var/www/web18/html/mediawiki/includes/OutputPage.php on line 352

Warning: Cannot modify header information - headers already sent by (output started at /var/www/web18/html/mediawiki/LocalSettings.php:1) in /var/www/web18/html/mediawiki/includes/OutputPage.php on line 262

Warning: Cannot modify header information - headers already sent by (output started at /var/www/web18/html/mediawiki/LocalSettings.php:1) in /var/www/web18/html/mediawiki/includes/OutputPage.php on line 290

Warning: Cannot modify header information - headers already sent by (output started at /var/www/web18/html/mediawiki/LocalSettings.php:1) in /var/www/web18/html/mediawiki/includes/OutputPage.php on line 291

Warning: Cannot modify header information - headers already sent by (output started at /var/www/web18/html/mediawiki/LocalSettings.php:1) in /var/www/web18/html/mediawiki/includes/OutputPage.php on line 293

Can you explain what I did wrong?

Regards Christian

ANSWER by mille:

The problem is that the first line of the document doesn't start with: <?php. In your editor it seems to be, but if you use the midnight commander editor, vi or nano you will see someting like: ï»¿<?php! Delete the content before <?php and it should work. If you haven't a root-login to your server, try it with windows notepad and then upload the file again.

Greez from Germany, mille

ANSWER BY Jrincon:

I tried to do what mille suggested and technically, that is correct. One problem though is that sometimes even if you are using notepad in Windows, this won't work because notepad won't show you all the characters. What I did was copy the entire text of the corrupted document onto a new LocalSettings.php and saved this new file where the corrupted one was. This worked like a charm. Apparently, copying the the entire text doesn't copy the character causing all the trouble.

Hope this saves someone the frustration I experienced.

Error in database
I have installed the ApacheFriends XAMPP (basic package) version 1.4.11 and mediawiki-1.3.9 on a local computer. Everything seems to work fine except when I try to run "Special:Randompage", "Special:Lonelypages", "Special:Uncategorizedpages" and "Special:Deadendpages". All I get is this error message: Warning: mysql_query: Unable to save result set in C:\Programme\apachefriends\xampp\htdocs\dewiki\includes\Database.php on line 182

and in the main article area (text is originally written there in german but I've translated it for you): Error in database There was an error in the syntax of the database query. It may be an illegal query or an error in the software. Last database query was: SELECT cur_id,cur_title FROM cur USE INDEX (cur_random) WHERE cur_namespace=0 AND cur_is_redirect=0 AND cur_random>0.307567902053 ORDER BY cur_random LIMIT 1 of the function "wfSpecialRandompage". MySQL generates error "1030: Got error 124 from storage engine".

Any ideas what the problem is? Thanks, Sandra

Thumbnails on Win2k+Imagemagick Broken
Thumbnails via Imagemagick don't work. They just display their alt text. I have imagemagick installed correctly, and have set all the proper variables in LocalSettings.php...

Edit: Solution found! Submitted patch to bugzilla.wikimedia.org to fix the imagemagick error. Paths passed to the system call needed to have quotation marks around them, lest spaces screw things up. The work-around seems to be to not use imagemagick. Furthermore, imagemagick screws up when making thumbnails of animated gifs (white noise on some frames), so it's best not to use it.

Trying to set up Email notification
I'm having issues when trying to get notification of watched pages to send. I've tried to send myself a lost password but I only get

"Error sending mail: Failed to connect to mailserver at &quot;localhost&quot; port 25, verify your &quot;SMTP&quot; and &quot;smtp_port&quot; setting in php.ini or use ini_set"

Any tips on getting theEmail function to work (or links to documentation, as I can't seem to find it) would be much appreciated.

Thanks,

Mike

Hi Mike

Suggest you look at this link which explains how you need to configure PHP (not actually MediaWiki itself !) to send e-mail. MediaWiki is dependent on the PHP environment being set up properly so it can "piggyback" on its e-mail capabilities.

The key is to point PHP to an SMTP e-mail server on your network (if in an Intranet) or your ISP (if connected to the Internet) that can forward the e-mails on to the recipient. That server could be a Unix box, a Windows box running Exchange with an SMTP connector, or some other machine, as long as it accepts SMTP and is happy to get it using the From: address configured by PHP (sendmail_from in php.ini).

In some instances, with IIS installed on your Windows box, you may have a local SMTP service enabled.

Cheers

Jason

TeX alternative
Is there a alternative to TeX? TeX is so large i don't think i will be able to download it.

And what is the smallest size of TeX with dvips?

Installing ImageMagic
I have sarted a wiki in a machine running WXP. I use the EasyPHP pack as server. It works perfectly. My problem is about installing Imagemagick. I do not know which pack must I install and where in my hard drive. Help pages explain how to change the settings in the LocalSettings.php file of mediawiki and other issues. But they do not explain where to install ImageMagick correctly. Would anyone help me? Tx. Wikiku

See this page in order to see where and how to install ImageMagick:

Newcomers_guide_to_installing_on_Windows

GregGarner

Failed to parse (unknown error)
I've just spent hours trying to figure this one out on Windows XP + Apache!

First I figured that since I download texvc.exe from the link above I didn't need OCaml, but I did. This didn't solve the problem in PHP, but the command now worked at the command line.

I eventually tracked the error to $contents being empty in includes/Math.php. By redirecting stderr (2>&1) I found out the error message was Cannot exec ocamlrun. Eventually I figured it must be a problem with the path, so I rebooted and it worked.

In summary:


 * Make sure you install OCaml
 * Reboot after installing, so the paths are updated (restart service didn't work)

Hope this helps someone.

--Dave (DJMz.com) 21:10, 9 Jun 2005 (UTC)
 * I get this error, and I hadn't installed OCaml. I've installed it and rebooted, but that didn't solve the problem. It still says Failed to parse (unknown error). When I run texvc in the command line, it does almost nothing (It prints '-'). What is it supposed to do? Any help appreciated Steveire 23:56, 26 February 2006 (UTC)
 * I solved this problem by commenting out some code in math.php which related to cygwin. Details here. Steveire 19:59, 2 March 2006 (UTC)

Specified key was too long;
Everything was going well, until this error came up.

Creating tables...Query "CREATE TABLE categorylinks ( cl_from int(8) unsigned NOT NULL default '0', cl_to varchar(255) binary NOT NULL default , cl_sortkey varchar(255) binary NOT NULL default , cl_timestamp timestamp NOT NULL, UNIQUE KEY cl_from(cl_from,cl_to), KEY cl_sortkey(cl_to,cl_sortkey(128)), KEY cl_timestamp(cl_to,cl_timestamp) )" failed with error code "Specified key was too long; max key length is 1024 bytes".

I'm running MySQL 4.1 server, PHP5 (which I do not believe has anything to do with this error), and Apache 2.

Any help on a solution to this error would be greatly appreciated!

-- Posted 1:30 pm MST July 22, 2005

I have the exact same problem, couln't find a solution yet.


 * Run MySQL 4.0, or set default MySQL charset to latin1 instead of utf-8, or install 1.5beta. --brion 08:20, 1 August 2005 (UTC)


 * Another option is to alter the database you want to use to use the latin1 default charset: ALTER DATABASE db_name DEFAULT CHARACTER SET latin1;

Finally (finally!) got the math output working on Windows
82.150.97.40 I followed the instructions overleaf to the letter, but still no joy. The only thing that worked for me was to edit the file  further as follows

--132.198.251.167 06:00, 13 February 2007 (UTC) I noticed that convert.exe is also the name of a windows utility as well as part of ImageMagick. That's may be where the issue stems from.

let cmd_dvips tmpprefix = "dvips -R -E -q \"" ^ tmpprefix ^ ".dvi\" -f >\"" ^tmpprefix^".ps\" " let cmd_latex tmpprefix = "latex -quiet \"" ^ tmpprefix ^ ".tex\" " let cmd_convert tmpprefix finalpath = "c:\\ImageMagick\\convert.exe -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

Note I have included the full path to convert.exe. I don't know why I need to do this, as convert.exe (and dvips, and latex) are all on the system path. Indeed running texvc from a command shell works fine even if I don't make this modification. But somehow when texvc is called from PHP it 'forgets' where convert.exe is and can't find it. You will have to modify this section to reflect where you have installed ImageMagick, which might not be in  (Note: Adding the ImageMagick path to the Windows PATH variable will also help here - Shane Kenyon).

132.198.251.167 05:27, 13 February 2007 (UTC) I noticed that convert.exe is also the name of a windows utility as well as part of ImageMagick. That's probably where the issue stems from.

Note also, I have commented out the part of render.ml that deletes the temporary files. Initially I did this for debugging purposes, but when I took the comments out at the end, nothing worked any more. Very strange! Anyway, it means that the images/tmp directory gets quite cluttered if a lot of users are creating equations, so I just manually clear it out every now and then.

I also had to comment out the following in Math.php so that things don't run in a cygwin shell.


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

REQUEST_URI vs SCRIPT_NAME
This article suggests changing REQUEST_URI to SCRIPT_NAME in all files. I have added the following lines to my LocalSettings.php and the same scripts will run on IIS/Windows and Apache/Linux. I haven't tried Apache/Windows, so I can't say that it works - but I suspect it will.

if (!isset($_SERVER['REQUEST_URI']) && isset($_SERVER['SCRIPT_NAME'])) { $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; if(isset($_SERVER['QUERY_STRING'])) { $_SERVER['REQUEST_URI'] .= "?" . $_SERVER['QUERY_STRING']; } }

--80.168.43.100 13:27, 13 January 2006 (UTC)

Texvc for Windows again
I am having problems with installing Texvc on Windows. I followed the instructions on this page but still I am getting an error. I am using xampp, cygwin and miktex for various elements.

I eventually got texvc to work, so when called by mediaWiki it produces an image in image/maths directory. However, I get an error on the page:

Failed to parse (unknown errorC:\texmf\tex\latex\base\article.cls Document (etc...)

--Adamk 13:00, 25 January 2006 (UTC)


 * maybe you forgot to adjust the ImageMagick-Part. I dunno if it was necessary, but i just did it and it works (didn't try it without adjusting).

texvc not working on 2003
Some people here appear to have had success w/ mathml on windows. I cannot get it to work. I'm followed all the directections as far as I can tell, I have the binaries, they are on the path, are in multiple locations, etc.

Any ideas?

-DavidA

texvc operation not robust, no feedback to say how to fix
Look, someone's got to improve texvc & the installation instructions.

I finally got the thing working, I think, but I had a hell of a time setting it up. There should be some notes that address the following issues:

1) You're going to want to turn debug logging on in LocalSettings.php, something like: $wgDebugLogFile = "{$IP}/debug.log.txt";

2) There needs to be an up to date version of texvc precompiled for at least the common platforms unix/win32/mac. The one listed here says 1.4.7 -- either it's out of date or there should be a note that says it's ok for versions 1.4.7 - 1.5.6

3) Please allow the cmd_dvips, cmd_latex, cmd_convert to be overridden. These should not be in a compiled executable. (Especially since there's that note about XP using convert to change hard disk partitions!) The PHP files do a good job allowing customization (not depending on getting the path setup right), this should too.

4) Please tell which versions of cygwin are acceptible. (how do you find out the cygwin version?) I have to run "bash" rather than "sh" in Math.php for some reason, also had to change escapeshellargs to just put single quotes around the inner command params since wfEscapeShellArgs gets called on top of it and for some bizarre reason cygwin just fails silently under so many circumstances when called from within Math.php. Maybe there are other ways of getting Math.php to work robustly under Windows, but I have no idea.

5) Make on my computer (and yes, I am running it under cygwin) fails with a cryptic error message: 'ml' is not recognized as an internal or external command, operable program or batch file. There must be something wrong with the makefile (I see no mention of any command "ml" being called) or my version of cygwin (not sure what version, I downloaded it within the last year)

Solution:

For your particular case(cygwin), I would think it's the MASM32 binaries that aren't being recognized, ml.exe in particular. If MASM32 Assembler is installed, go to Control Panel->System->Advanced->Environment Variables->System, and add the "bin" directory for the tool (use full address) to the path variable. Next, add the "lib" directory to the lib variable and the "include" directory to the include variable. If you find no lib or include system variables just create new ones.

--Fernando González 07:55, 1 June 2006 (UTC)

6) The precompiled version seems to run, but it does not produce an error log. Texvc really should produce an error log. (which it could go ahead & delete if all is well)

7) The only progress I've been able to make was by turning a debug log on (see cmt #1). I cut & pasted the cygwin command into a cygwin window on my server & ran it. The output when I run it interactively is much more helpful than the output gathered automatically from Math.php's  which I'm guessing doesn't capture stderr. (I don't know Perl & have no interest in learning it, sorry if that offends some of you) Therefore any errors when running the texvc command do not show up in Math.php's call to wfDebug.

8) I finally figured out that the gsview installation on cs.wisc.edu installs ghostview but not ghostscript (gswin32c.exe) which is what Math.php calling texvc calling convert seems to be looking for.

9) This is complicated enough that you really need a detailed troubleshooting guide, to turn on debug logging for something that produces an output that shows which steps worked & which steps failed:  WIKIMATH STEP 1 (Math.php) SUCCEEDED   WIKIMATH STEP 2 (texvc.exe) SUCCEEDED   WIKIMATH STEP 3 (latex) SUCCEEDED   WIKIMATH STEP 4 (dvips) SUCCEEDED   WIKIMATH STEP 5 (convert) FAILED

This and a quick guide for what can go wrong would have saved me hours of frustration.

10) This whole process should really be simpler...

I was very impressed by how smoothly the install for Apache/MySQL/PHP/Mediawiki went. The tex/Math install/docs do not measure up to the same quality.

--Arghman 21:53, 24 February 2006 (UTC)

Gack! It still doesn't work after all, it only works if I copy the command from the debug log & run it in a command window myself. No clue of any trouble from the wfDebug, all it says for tex output is c1c0608dbfe281f9c9e4c4a6b63317d40f(x) = a'x2 + b'x + c  which I'm guessing is a hash + mathML output for some reason... the .tex and .tmp files show up but not the png file.

If I run this from within a win32 command window, running in the same directory (which I've verified by temporarily putting "pwd" in the command-to-run), it creates the same output text and the .png shows up properly. - - - - :fuming: - - - - Arghman 22:01, 24 February 2006 (UTC)

texvc tips
for version mediawiki-1.5.7, in /includes/Math.php


 * command out the following sections:

/*	if( function_exists( 'is_executable' ) && !is_executable( $wgTexvc ) ) {

return $this->_error( 'math_notexvc' ); }



/*								if ( wfIsWindows ) { # Invoke it within cygwin sh, because texvc expects sh

features in its default shell $cmd = 'sh -c '. wfEscapeShellArg( $cmd ); }

//if it works for you, please make a vote below; when there is sufficient votes, someone can move it to the main help file. cheers.

Math display problem: Failed to parse (PNG conversion failed)
I got the following message "Failed to parse (PNG conversion failed; check for correct installation of latex, dvips, gs, and convert): a+b" while I tried to use $$ a+b $$. I also tried above discussed methods, still no luck.

The mediawiki server runs under the windows xp, apache 2.2.0, php 5.1.2 environment.

I have modified the render.ml, math.php, Image.php, and LocalSettings.php as http://meta.wikimedia.org/wiki/Help:Running_MediaWiki_on_Windows said. The php_imagick.dll extension for php is also enabled.

If I use the command line: texvc images\tmp images\math a+b utf-8, the .png file is created in images\math folder properly. Seems convert, latex, dvips, gs all working properly under the command line.

Where could be wrong? Any suggestion? Thanks.

- I have the same problem, I've experimented with all I know but can't find a fix.

- Also ended up with the same problem but have managed to dig a little deeper. I am trying to get this working in Windows 2003 and IIS 7.

In Math.php I commented out the code that relates to cygwin as follows

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

and granted access to cmd.exe found in the widows\system32 directory to IIS (I_USER_[Server Name]).

This was so that texvc.exe would run which incidentally is done with the line: $contents = `$cmd`; in Math.php

At this point, texvc.exe was producing a .tex file in the images\tmp but no other files.

So now that I knew the problem was within texvc.exe, I switched from using the .exe file to compiling it myself using minw32-make.exe so that I could debug. Within render.ml I have tried various things but I am stuck on an error when the latex command is run (which is the next command to run as it converts the .tex file to a .dvi file). The error is:

- "The file system path could not be retrieved." from latex when run from render.ml so it seems this is the problem.

To view the error I had the following in render.ml ' let cmd_latex tmpprefix = "latex 1988_64f1bb2a09b6c7a2739f6333bb864a94.tex 2> test.log" ' where the .tex file is a file I was testing with in the images\tmp directory and '2> test.log' logs the error from latex.exe.

- If anyone else has this error or can get past this error then please let us know.

Apache/EASYPHP/MySQL/MediaWiki 1.5.7 Root Question
Hi,

I found the easyphp installation on my winXP system rather easy and effective. It only took me about an hour for the basic set-up and I was able to start working on the content. I had a much harder time setting up a dynamic dns (and that was not that bad either).

Anyway, my question: with the standard easy PHP solution, the mediawiki folder is in a www folder and when I access the wenserver, I first get to the www folder/page. Then I have to click on a little folder symbol to actually get to the mediawiki. Is there a way to set up the mediawiki or apache or whatever, so that the website root is directly the wiki? I tried setting the document root in apache's httpd.conf to: DocumentRoot "${path}\www\mediawiki-1.5.5" and:  but that did not work. Any ideas?

Thanks, Andy 63.125.44.226 23:11, 7 April 2006 (UTC)

Question about MYSQL server problem.
I've been wandering around in FAQ's and various places for a few days trying to see if there was an answer to the problem I've been having. I recently installed MediaWiki on my personal computer, using EasyPHP. I got the database up and running just fine, and a few days later figured out getting image resizes and all that to work. I had several good days of work on it, and then one day my Wiki quit working. I go to load up my page, and I get: (Can't contact the database server: Can't connect to MySQL server on 'localhost' (10061) (localhost)). I tried re-starting EasyPHP, rebooting the machine, re-installing EasyPHP, but nothing has worked. I had recently installed some Windows updates and I think that might have been what killed it, since I think that's when it quit working. I've been trying to figure out what the troubleshooting process is I should go through, but I haven't had any luck researching that. Can someone provide any suggestions please? Thanks, Evilphoenix 21:33, 16 April 2006 (UTC)

Problem creating accounts
I have installed MediaWiki on Windows XP with IIS 5.1 PHP and MySQL, this works oke. Now i configured php.ini so it can send mails with a SMTP server in our network. But if the Wiki hasn't been used for a long time, for example when I try to create an account in the morning I get an error after 1 minute in usermailer.php. But it looks like the MySQL server isn't responding to creating a new record because I do get an email saying the account has been created (this doesnt work though). After trying a couple of times the error is solved and creating an account goes oke. Anyone can help? --Alexander 08:34, 23 May 2006 (UTC)

Testing latex, dvips and convert
test.bat

latex test.tex dvips test.dvi -o test.ps    convert -density 120 -trim -transparent #FFFFFF test.ps test.png

test.tex

\documentclass{article} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \pagestyle{empty} \begin{document} 2 + 2 * 2 = 6    \end{document}

Run cmd.exe and type 'test.bat' to make sure that latex, dvips and convert works correctly.


 * I've install MikTex, then I typed "latex test.tex", but it didn't generate any thing..just a blank screen.. why? --Kornelius

C:\htdocs\mediawiki\math>latex test.tex

C:\htdocs\mediawiki\math>dvips test.dvi -o test.ps This is dvips(k) 5.95a Copyright 2005 Radical Eye Software (www.radicaleye.com) dvips: ! DVI file can't be opened.

C:\htdocs\mediawiki\math>convert -density 120 -trim -transparent #FFFFFF test.ps test.png convert: unable to open image `test.ps': No such file or directory. convert: missing an image filename `test.png'.

C:\htdocs\mediawiki\math>

Help me: install math with Mediawiki 1.6.7
Anyone help me do it!--Nguyen The Phuc 06:26, 8 July 2006 (UTC)

Installing MediaWiki on an IIS server
I bought a domain name and hosting. The server my website is on apparently uses IIS instead of Apache. Since I don't own the server and don't have access to it, I can't change its settings so that I can successfully install MediaWiki on it. Does this mean I'll never be able to put MediaWiki on my website?

[Unparseable or potentially dangerous latex formula. Error 3 ]
I tried to setup math under the following environment: Windows 2K3 MEdiawiki 1.7.1 IIS I followed the steps given on http://meta.wikimedia.org/wiki/Help:Running_MediaWiki_on_Windows#Another_way_to_use_math_under_windows_v2 After inputting a simple formula, $$x$$, I receive the error


 * Same here, are we missing something? -80.56.0.49 16:12, 7 September 2006 (UTC)
 * Please try Alternative Solution 1, I've updated it slightly. The problem was that if the directory containing certain programs had a space in it then you would get an error that was not displayed. The fix was to put some "\".'s round it. Andrewdodd13 21:10, 9 September 2006 (UTC)
 * I've tried new Alt solution 1, and I no longer get the error, but a blank screen. I've rolled back to the earlier version and re-installed the software so that I do not have any spaces, and still get the Error 3. Anyone else get this to work on IIS ? --JamesH 10:19, 19 September 2006 (UTC)
 * I also tried this solution but I always get Error 3. I used wiki 1.8 and the latest PHP. I can't belive that someone hasn't been able to provide one good method of how to accomplish latex on Windows using IIS. If you have the solution, please email me at elsenormalo AT gmail.com
 * It seems that ImageMagick's convert.exe needs Ghostscript installed. After installing it, my formulae started showing correctly. I also added full paths in the modified math.php to latex, dvips, convert and identify.exe (as recommended for LocalSettings.php) &rarr; MediaWiki 1.9, php 5.20, Windows XP SP2, Apache 2.0.59

A step by step procedure to use LaTex in MediaWiki on windows servers
I finally sucessfully configured LaTex on windows XP sp2 + Saint WAMP.

1. download and install Saint WAMP

2. download and install LaTex. 

3. download and install Ghostscript Remember to put the path of gswin32.exe in the system path. To do this, go to "Control Panel" -- "System" -- "Advance" -- "Envorenment Variables" -- Add the folder you installed gswin32.exe in the variable "Path".

4. download and install ImageMagick. Also add the path into "Envorenment Variables".

5.download and install Mgwin-make

6. install MediaWiki

7. Modify math\render.ml so it looks like,

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

8. make the bytecode version texvc.bc (in the dos window, first go the the folder with math files, run command mingw32-make texvc.bc then rename texvc.bc to texvc.exe.

9. move the file texvc.exe to the folder with localsetting.php

10. In /includes/Math.php replace the following:

wfDebug( "TeX: $cmd\n" );

with the following:

$cmd=str_replace("'","\"",$cmd); wfDebug( "TeX: $cmd\n" );

11. In LocalSettings.php, change

$wgUseTeX= false;

to

$wgUseTeX= true;

and add this line

$wgTexvc = "texvc.exe";

You are done now. Good luck.

Math: Alternative solution 2
The Math.php code in above did not work for me as it is. I had to do the following modifications: 276d275 <        $this->cleanTemporaryDirectory; 278a278 >                $this->cleanTemporaryDirectory; 284c284 < --- >        $this->cleanTemporaryDirectory; 292d291 <        392d390 < (Otherwise, the formulas return empty images.) Assela 08:14, 25 September 2006 (UTC)

-I've never had this problem, I can take the code straight from the page and it'll work without any modifications. Add to the fact that I have no idea what those modifications actually do... Andrewdodd13 18:05, 26 September 2006 (UTC)


 * runs as described on few diffrent servers. Thanx for that... --Hindermath 21:56, 6 October 2006 (UTC)

MiKTeX with MediaWiki

 * I tried to configure MiKTeX with MediaWiki on Windows 2000 and the result was successful.


 * 1) Compiled texvc using MinGW 3.1.0 just by running 'mingw32-make'. It didn't work out-of-the-box.
 * 2) Enabled debugging by adding '$wgDebugLogFile = "{$IP}/debug.log.txt";' to LocalSetting.php.
 * 3) Examining the debug.log.txt, found out that latex is outputing some info and it messes with texvc output.
 * 4) Used quiet switches and all commands (latex, dvips, convert) and it still didn't work. Added '>nul' at the end of latex command in math/renderer.ml and ...
 * 5) It worked!!!

I have also replaced '/' with '\\' in math/renderer.ml and changed the command in includes/Math.php to not to use 'sh -c' when running texvc.exe. I'm not sure if this will cause problems from now on, but I hope it won't.

Hope this helps someone.

Texvc on Windows XP with XAMPP Lite (also using MikTex)
This is what works for me.

My system info

 * Windows XP Professional (English)
 * XAMPP Lite: 1.4.16 (Obtained from SourceForge', containing:
 * Apache 2.0.54
 * MySQL 4.1.14
 * PHP 5.0.5 + PEAR (basis package)

Required Software
You will need to install the following software:


 * Ghostscript (version 8.53)
 * MikTex (version 2.5)
 * Object Caml (version 3.09.3)
 * ImageMagick (version 6.3.1 Q16)
 * (I downloaded the file ImageMagick-6.3.1-7-Q16-windows-dll.exe)
 * A compiled version of texvc.exe, e.g. the one here (which I found above on this page).

You can install the software anywhere you want on your local computer. I remember that in the installation of Image Magick I choose to run it as an NT-service (there's an option where you can choose).

Preparations
$wgUseTeX          = true; $wgMathPath        = "{$wgUploadPath}/math"; $wgMathDirectory   = "{$wgUploadDirectory}/math"; $wgTmpDirectory    = "{$wgUploadDirectory}/tmp"; $wgTexvc = "texvc.exe"; # Location of the texvc binary // Enable debug logging $wgDebugLogFile = "{$IP}/debug.log.txt"; if ( wfIsWindows ) { # Invoke it within cygwin sh, because texvc expects sh features in its default shell $cmd = 'sh -c '. wfEscapeShellArg( $cmd ); } Then finally you have to give sufficient rights to the apache process in windows. // SHL 06:22, 14 January 2007 (UTC)
 * Place the downloaded texvc.exe in your mediawiki folder, (e.g. 'e:\xampplite\htdocs\wiki')
 * Configure your LocalSettings.php to contain something like (Search for the comment-text below in your localsettings.php-file in order to find the appropriate place for the changes):
 * 1) If you have the appropriate support software installed
 * 2) you can enable inline LaTeX equations:
 * For testing purposes it can also be useful to include:
 * Make sure the folders specified above exists and are writeable by the webserver. In my case these were:
 * /images/tmp/
 * /images/math/
 * Comment out the following lines in /includes/Math.php (I've removed some whitespaces, so you might not be able to search for the whole "phrase" in your file)
 * Install apache as a windows service (by checking the "svc" checkbox in the xampp control panel):
 * Open the "Computer management" tool (e.g. by choosing "start > run" and typing "compmgmt.msc")
 * Right-click the "Apache2" process
 * Choose properties
 * Select the tab "Log on"
 * Choose to log on as "This account" (clicking a radiobutton).
 * You will also have to click "Browse...", and type the name of a user-account with administrator privilegies (In my case this was my personal account, but you might need to choose 'Administrator' or something like that...) and click "Check names"
 * When done, click OK.
 * Click OK or Apply
 * Done!

Math on webhosts
After testing every single suggestion on how to get math working on MediaWiki I finally stubmled upon Mimetex,

Mimetex requires CGI script on the server but nothing else.

A fairly simple "tutorial" can be found here: LaTex on a shared host

Complete tutorial for texvc, please
I've tried all the solutions to compile texvc with mingw32-make and others, without any results ... Can you tell me precisely, how and which program use to make it ?
 * Did you try the precompiled exe file from here? I used it for my config. -- SHL 17:14, 20 February 2007 (UTC)

Mediawiki - Tex and Windows
When I try to use Tex with my Mediawiki installation under Windows XP and Xampp, I get the following error:

Parser-Fehler (Unbekannter Fehler): 2x (Parser-Error (Unknown Error))

Is there something obvously wrong with my installation?

MediaWiki 1.9.2
I followed your usefull guide to install my config: XP Pro SP2 + EasyPHP 2.0b1 + MediaWiki 1.9.2. It took a while but it is up and running now including edition of Math equations! I had to install cygwin to get make and ocaml compiler. I recompiled render.ml. No need to point to textvc.bc. Very good work :-)

Cheers, --Antoine Sirianni 01:20, 10 March 2007 (UTC)

Minor bug if path contains spaces
consider using this code instead:

// math patch for windows $cmd =  $wgImageMagickConvertCommand. " {$quality} -background white -size {$width} ". '"' .                  str_replace( chr(47),chr(92), $this->imagePath) .                   // Coalesce is needed to scale animated GIFs properly (bug 1017).                   '"'. " -coalesce ". // For the -resize option a "!" is needed to force exact size, // or ImageMagick may decide your ratio is wrong and slice off // a pixel. " -thumbnail {$width}x{$height}!" .                  " -depth 8 ". '"' .                  str_replace( chr(47),chr(92), $thumbPath) . '"'. " 2>&1";                  //$fp = fopen("myoutputlog.txt", "w");fwrite($fp, $cmd);fclose($fp);

--Antoine Sirianni 07:43, 16 March 2007 (UTC)

Math
In a semi-circle, the length x can be represented by the formula: $$x=\sqrt{AB}$$

Alternative Math method using dvipng
When I try to render the equation: x\equiv\sqrt{ab}, I get these errors: Warning: unlink(C:\Documents and Settings\HP_Owner\My Documents\xampp\htdocs\wiki/images/tmp/163e836b057fa98808f41048cba1195f.aux) [function.unlink]: No such file or directory in C:\Documents and Settings\HP_Owner\My Documents\xampp\htdocs\wiki\includes\Math.php on line 298

Warning: unlink(C:\Documents and Settings\HP_Owner\My Documents\xampp\htdocs\wiki/images/tmp/163e836b057fa98808f41048cba1195f.log) [function.unlink]: No such file or directory in C:\Documents and Settings\HP_Owner\My Documents\xampp\htdocs\wiki\includes\Math.php on line 299

Warning: unlink(C:\Documents and Settings\HP_Owner\My Documents\xampp\htdocs\wiki/images/tmp/163e836b057fa98808f41048cba1195f.dvi) [function.unlink]: No such file or directory in C:\Documents and Settings\HP_Owner\My Documents\xampp\htdocs\wiki\includes\Math.php on line 300

Warning: unlink(C:\Documents and Settings\HP_Owner\My Documents\xampp\htdocs\wiki/images/tmp/163e836b057fa98808f41048cba1195f.png) [function.unlink]: No such file or directory in C:\Documents and Settings\HP_Owner\My Documents\xampp\htdocs\wiki\includes\Math.php on line 301

and

[Unparseable or potentially dangerous latex formula. Error 3 ]

can some one help? --Admin of Onekopakaspace Wiki

Getting hold of texvc.exe for windows
I just cant find it compiled and ready to run anywhere. GNU make is even harder to find. I have the source code for GNU Make but it won't compile (missing files (fixable by tweaking the source code) and code error warnings (unfixable without more knowledge about C, which I don't have)) with any of three C compilers I have tested. So what I would like to have is a direct link to either texvc.exe or make.exe for windows. 81.170.148.152 23:05, 12 April 2007 (UTC)

Alternative Method Correction
Hi, I'm MetaSharp (already updated the alternative method a lot). I just modified it a bit to explain that you must use the complete miktex distrib, else only a few formulas will work. I also included the pertinent comment about Ghostscript.