# Manual talk:Running MediaWiki on Windows

The following discussion has been transferred from Meta-Wiki.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).

## 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"))
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)

I hope that this is the right place to ask.. I've tryed for hours to install Mediawiki with texvc, Mediawiki works perfekt but i couldn get texvc work. I'm using win32 xp and xampp could someone pleace be so nice and give me a working mediawiki Folder or the parts of the folder i need ? Thanks Philipp Philadelphia 00:45, 23 January 2009 (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)

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

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 {{feature}}

Selected anniversaries {{July_7_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
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"))
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".

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

## 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)
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$

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). ## If you have the appropriate support software installed ## you can enable inline LaTeX equations:$wgUseTeX               = true;
$wgMathPath = "{$wgUploadPath}/math";
$wgMathDirectory = "{$wgUploadDirectory}/math";
$wgTmpDirectory = "{$wgUploadDirectory}/tmp";
$wgTexvc = "texvc.exe";  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. • 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,$wgMathDirectory = "images/math"; $wgTmpDirectory = "images/tmp";$wgTexvc = "math/texvc.exe";

## 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

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

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.

Brilliant! Thanks Jrincon, you've managed to close off 2 hours of annoying headscratching after I innocently added a couple of lines to LocalSettings.php to try an extension that didn't work out. When I removed the lines I suddenly started getting similar errors to the above. Neither Notepad or Notepad++ showed any dodgy characters at the start of the file, but copying the text into a blank file and renaming worked a treat.

Many other sites explained that whitespace or other characters in front of <?php would cause this, but none I found explained that corruption of the file would have the same effect.

cheers Gordon 62.6.161.118 13:21, 26 March 2008 (UTC)

## 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 "localhost" port 25, verify your "SMTP" and "smtp_port" 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#ImageMagick

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 render.ml 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 c:\ImageMagick (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. # if ( wfIsWindows() ) { # # Invoke it within cygwin sh, because texvc expects sh features in its default shell #$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)

It works nice. I always have this problem on IIS/Windows. --Zayoo 06:24, 2 September 2010 (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 $contents = $cmd; 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
c1c0608dbfe281f9c9e4c4a6b63317d40<i>f</i>(<i>x</i>) = <i>a</i><i>x</i><sup>2</sup> + <i>b</i><i>x</i> + <i>c</i>

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 m: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.


### Fixing the error

Windows Vista has some new way of doing things. Solution:

1. go to command line

2. make sure that you can run pdflatex fine

3. type "set"

4. copy everything that was printed to the screen, eg:

HOMEPATH=\Users\Foo
LOCALAPPDATA=C:\Users\Foo\AppData\Local
LOGONSERVER=\\BAR
NUMBER_OF_PROCESSORS=2

5. create a new batch file somewhere, name it pdflatex.bat — 6. paste the stuff from above into your file, and prefix each line with "set ":

set HOMEPATH=\Users\Foo
set LOCALAPPDATA=C:\Users\Foo\AppData\Local
set LOGONSERVER=\\BAR
set NUMBER_OF_PROCESSORS=2

7. Put "@echo off" at the first line, and "pdflatex.exe %*" at the last:

@echo off
set HOMEPATH=\Users\Foo
set LOCALAPPDATA=C:\Users\Foo\AppData\Local
set LOGONSERVER=\\BAR
set NUMBER_OF_PROCESSORS=2
pdflatex.exe %*

8. save, and point texlipse or your editor to this batch file instead of pdflatex.exe

### Fixing the error 2

I have mediawiki (1.12.0) running under Windows Vista, Apache 2.2.8, PHP 5.2.6 environment. I followed this manual and installed all the necessary programs, compiled texvc and configured LocalSettings.php. Then I tested formulas from Help:Displaying a formula page. Some worked but some throwed either "Failed to parse" or "PNG conversion failed" errors. I tried some debugging and really found a solution.

First of all I commented the following fragment of code in includes/Math.php (I don't have cygwin installed):

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


Then I tried some of the commands generated by

$cmd =$wgTexvc . ' ' .
escapeshellarg( $wgTmpDirectory ).' '. escapeshellarg($wgTmpDirectory ).' '.
escapeshellarg( $this->tex ).' '. escapeshellarg($wgInputEncoding );


and found out that newline character in math expression devided one command into several commands no matter what quotes were used. In order to get rid of newlines I changed the code to following:

set_time_limit(180);
$cmd =$wgTexvc . ' ' .
escapeshellarg( $wgTmpDirectory ).' '. escapeshellarg($wgTmpDirectory ).' '.
escapeshellarg( str_replace(array("\r", "\n"), ' ', $this->tex )).' '. escapeshellarg($wgInputEncoding );




and: <Directory "${path}\www\mediawiki-1.5.5"> 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 m: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) → MediaWiki 1.9, php 5.20, Windows XP SP2, Apache 2.0.59 I had this same error. After much tracking I narrowed down the problem to the execution of the exec() function of latex. I corrected execution permissions on latex and read/write permissions on the temporary directories. The problem persisted, and then found that exec() runs the command through cmd.exe and IUSR_xxx by default has execution permissions denied on this shell. After enabling that the problem went away.--juanvp Could you explain that? I'm having the same problem and none of the other suggestions have helped. ~ WindOwl 08:52, 10 October 2007 (UTC) MY SOLUTION, hey guys, after some hours of trying this and that I found the reason for the error (at least on my machine): the directory names get mixed up somewhere! As the directories of those programs should be in your PATH anyway, just change this to: • insert in$/LocalSettings.php:
#ImageMagick
$wgImageMagickConvertCommand = 'convert.exe';$wgImageMagickIdentifyCommand   = 'identify.exe';
#Tex
$wgLaTexCommand = 'latex.exe';$wgDvipsCommand                 = 'dvips.exe';

Done I confirm problem and solution with Vista 64 Ultimate SP1, BitNami MediaWiki Stack 1.15.1-0, GhostScript v8.70, MiKTeX 2.8, ImageMagick 6.5.8 Q16 (x64 static) - Thank you! Paradoctor 02:25, 21 December 2009 (UTC)

It doesnt works on my server. i use mediawiki 1.16.5 and get this error Solution was to refresh the math.php in the includes-dir. see Manual:Running MediaWiki on Windows/math.php :: Done (maybe save into the unix/dos format)

## A step by step procedure to use LaTex in MediaWiki on windows servers

I finally sucessfully configured LaTex on windows XP sp2 + Saint WAMP.

3. download and install Ghostscript [3] 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".

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
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"))
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;

$wgTexvc = "texvc.exe"; You are done now. Good luck. ## Notes to the above procedure If you not use server, and this doesn't work, you maybe forget to comment out the following lines in includes\Math.php (this was the only problem I had to solve on windows vista business 32 bit edition, xampp 1.7.0, miktex 2.7, ocaml 3.11.0, ghostscript 8.63 (maybe you should copy and rename the gswin32c.exe to gs.exe in the same directory, where the gswin32c.exe exist), imagemagick 6.4.9 Q16 dynamic. MinGW 5.1.4 - and be every program bin directory in PATH!): # if ( wfIsWindows() ) { # # Invoke it within cygwin sh, because texvc expects sh features in its default shell #$cmd = 'sh -c ' . wfEscapeShellArg( $cmd ); # }  ## 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)
• 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

• 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):
## If you have the appropriate support software installed
## you can enable inline LaTeX equations:
$wgUseTeX = true;$wgMathPath         = "{$wgUploadPath}/math";$wgMathDirectory    = "{$wgUploadDirectory}/math";$wgTmpDirectory     = "{$wgUploadDirectory}/tmp";$wgTexvc = "texvc.exe"; # Location of the texvc binary

• For testing purposes it can also be useful to include:
// Enable debug logging
$wgDebugLogFile = "{$IP}/debug.log.txt";

• Make sure the folders specified above exists and are writeable by the webserver. In my case these were:
• <wikipath>/images/tmp/
• <wikipath>/images/math/
• Comment out the following lines in <wikipath>/includes/Math.php (I've removed some whitespaces, so you might not be able to search for the whole "phrase" in your file)
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.

• 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!

// SHL 06:22, 14 January 2007 (UTC)

## 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

        // 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

I have the identical error for my site...did you ever come up with a solution? I have tried all the different techniques and tried debuggint he math.php file myself but havent been able to resolve the issue.

## 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.

## My Troubles with texvc

I have added some remarks about troubleshooting the texvc method. It took me all night to get this working, so I hope it will keep you from jumping out of the windows too... --88.67.31.122 10:28, 28 May 2007 (UTC)

## Parse Error with math: a'

I've got the math tags up and running, and everything seemed fine, until I had to enter a formula with "a'" in it, which causes a parse error. I used the cygwin-free method under troubleshootingManual:Running MediaWiki on Windows#troubleshooting. Could it have something to do with the changes to math.php made there? (I doubt it but it just seems so wierd). The formula works fine if I directly make a latex file with $\frac{a}{b}a'$ in it. 84.104.220.211 13:01, 14 June 2007 (UTC)

## Manual:Running_MediaWiki_on_Windows#Alternative_Solution_with_dvipng

This solutions runs best in my MW 1.11.0 version under Windows XP SP2 with XAMPP. --Hindermath 23:21, 23 September 2007 (UTC)

## Upload files with special characters?

Hi! I'm using MediaWiki in my company and there are problems uploading files containing special characters like ä, e.g. "Täst.TXT" It seems like MediaWiki is aware of the uploaded file (No errors/warnings etc) and the link [[Bild:Täst.TXT]] turns valid. But the file is stored as ".../images/3/3b/TÃ¤st.TXT" and the link itselfs directs to "...images/3/3b/T%C3%A4st.TXT"

Does anyone know what the problem could be and how to solve? --Hakuin 09:15, 29 November 2007 (UTC)

Version (using xampplite)

• MediaWiki: 1.10.1
• PHP: 5.2.0 (apache2handler)
• MySQL: 5.0.27-community

Hi ! Yes, we have a solution, but it was done by patching the mediawiki itself. 4 files have to be patched until it can be used under win32. See and read more information (in german language) under Modifikationen:Windows_Dateiumlaute. There the four files are already patched can be reviewed and used on your own risk. Since these patches, we a able to use german Umlaute as expeced ;) It was tricky to find the right place, but I think I have them found all And yes, it also works with deleted and restored or renamed/ new versioned image and filenames with or without umlaute.

## Installing MediaWiki without MySQL

My web host uses Windows 2008 IIS and therefore does not support MySQL. Is there any way to run MediaWiki on that host?

## Good ol' TeX

My, my. Seems someone wise, kind and omnipotentious could make us a great favour writing all possible variants of TeX installation - with different MW, OS etc.

Well, I've got W2003S, MediaWiki 1.13.2, PHP 5.2.9-2 (apache2handler), MySQL 5.0.67-community-nt, full MikTeX 2.7.3224 (spaces in the path... Is it vital? I don't want to reunzip all those archives -_-), ImageMagick 6.5.2-3-Q16-windows-static, GS, Math.php as the default + from "alternative solution" + from "alternative solution with dvipng", compiled texvc.exe from somewhere over here,

$wgUseTeX = true;$wgImageMagickConvertCommand    = 'C:\immagick\convert.exe';
$wgImageMagickIdentifyCommand = 'C:\immagick\identify.exe';$wgLaTexCommand                 = 'C:\Program Files\MiKTeX 2.7\miktex\bin\latex.exe';
$wgDvipsCommand = 'C:\Program Files\MiKTeX 2.7\miktex\bin\dvipng.exe';$wgMathPath         = "{$wgUploadPath}/math";$wgMathDirectory    = "{$wgUploadDirectory}/math";$wgTmpDirectory     = "{$wgUploadDirectory}/tmp";$wgTexvc = "texvc.exe"; # Location of the texvc binary
$wgDebugLogFile = "{$IP}/debug.log.txt";

PATH=C:\Program Files\MiKTeX 2.7\miktex\bin;c:\immagic;C:\PHP\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\MySQL\bin;
C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\Objective Caml\bin; C:\gs\gs8.54\bin


I've already passed the "unparseable or potentially dangerous", but formulae images still don't show up on the pages, as here. Could anyone tell me what the problem can be?

Hi, I had the problem with the error "unparseable or potentially dangerous" an for me it worked when I used double quotes like this:

$wgImageMagickConvertCommand = "convert.exe";$wgImageMagickIdentifyCommand   = "identify.exe";
$wgLaTexCommand = "latex.exe";$wgDvipsCommand                 = "dvipng.exe";


## Standardization of main symbols

Name Symbol Unite
Force F$f^2$ Newton (N)
Length L or l m or mm
Temperature T K or °C
Amperage I Ampere (A)
Shear stress tau N/mm^2
Shear modulus G N/mm^2
Strain (engineering) epsilon
Strain (true) phi
Area, Cross section A, S mm^2
Diameter D mm
Stress (engineering) sigma N/mm^2
Flow stress $k_f$ N/mm^2
Time t second (s)
Particle velocity u^dot, v^dot, w^dot 1/s
Volume V $mm^3$
Stress invariants I N/mm^2
General constant c
Shear yield stress k
Width b mm
Anisotropy (Lankford Parameter) r
Hardening Exponent n
Hight h mm
Frictional coefficient mue

## Unicode problem

Hello! Can u help me? I know: Windows Server have big problem with Unicode, and because of that Mediawiki have problem too (ex.:I cant upload Cyrillic Name's files). What can I do? Iniquity (talk) 16:07, 19 February 2012 (UTC)

## EasyPHP 5.3.9 and MediaWiki

I use EasyPHP 5.3.9, however when trying to install MediaWiki the Apache service stops and this problem occurs only with MediaWiki. How do I fix?

## Diff3: Unexpected null result

I'm having some trouble with diff3.exe. I have in localsettings:

## robust naming for instructions for specific webserver/database stacks

Right now the article links to a Manual:Streamlined Windows Install Guide which covers a simplified installation using XAMPP.

There are also now very clear step by step instructions for XAMPP and bitnami Manual:Running MediaWiki on Windows/bitnami that include Semantic Bundle installs.

With the variety of stacks, including some like XAMPP that support streamlined installers like Bitnami, and some that support Nginx, etc., we need a robust naming scheme for all these stack-specific installations.

Something like os-webserver-database-installer where "installer" is either the format (tgz, zip) or the provider of the .exe file, which could be wikimedia if it provides a .exe

Windows7-Nginx-MySQL-bitnami (.exe)
Windows8-Apache-MySQL-bitnami (.exe)
Windows10-IIS-MSSQL-wikimedia (.exe)
Windows10-IIS-MySQL-tgz (the developer released .tgz)
Linux-Nginx-MySQL-bitnami (.exe)
Linux-Nginx-MySQL-zip (the developer released .zip)