Manual:Installing MediaWiki on Windows XP - MediaWiki 1.7.1
From MediaWiki.org
| The content of this page has not been verified. Instructions written in this page have not been verified to be correct. |
Contents |
[edit] About
This article is a refresh of an old one article Installing MediaWiki on Windows XP - MediaWiki 1.5 which is obsolete for MediaWiki 1.7.1.
--ChameleonRedOne 11:34, 29 September 2006 (UTC)
New version o this article is available - which is specific to Installing MediaWiki on Windows XP - MediaWiki 1.9.2.
--ChameleonRedOne 18:50, 14 February 2007 (UTC)
[edit] Components
[edit] Server
- MediaWiki 1.7.1 (also MediaWiki 1.8.2)
- PHP 5.1+
- MySQL 5.+ (Last working is MySQL 5.0.24 - MySQL 5.0.26 doesn't work)
- Cygwin
- Windows XP
- HTTP/IIS 5.1
- SMTP/IIS 5.1
[edit] Supporting
- Notepad++ (for syntax highlight)
- Telnet (for SMTP)
- Explorer (for rights)
- IIS Console
- Internet Explorer 6.0+
- WinMerge (for file differences analysis)
[edit] Result
Working MediaWiki - I don't know if it not advertisement if I put link here -> [1]
[edit] Steps to Start MediaWiki on IIS
[edit] Install PHP
- Information bellow is related to PHP 5.1.6 so it also apply to any PHP 5.+
- Get php setup *.zip from [2] and install to any path i.e. c:\php.
- DO NOT choose to install all extensions; select only the ones you need. If additional extensions are requested, but not supported on your system, PHP will puke when it can't find them. This has the frustrating consequence of a good install not working.
- Try to setup IIS extensions by php-cgi.exe automatically or make the same manually by configuration virtual directory cgi extensions (for rookie administrators first option is suffcient and safe)
- Optionally you could use php_isapi.dll instead of php-cgi.exe for better performance by configuration virtual directory cgi extensions (only on MediaWiki virtual directory configuration - remember to don't setup php_isapi.dll as root directory configuration - remove php_isapi.dll from root directory configuration if you did automatic PHP configuration on IIS before - that is need from security reason to not propagate php through all IIS if it not need).
- After setting up php_isapi.dll set enviroment variable PHPRC=c:\php
- Optionally you could use php_isapi.dll instead of php-cgi.exe for better performance by configuration virtual directory cgi extensions (only on MediaWiki virtual directory configuration - remember to don't setup php_isapi.dll as root directory configuration - remove php_isapi.dll from root directory configuration if you did automatic PHP configuration on IIS before - that is need from security reason to not propagate php through all IIS if it not need).
- Create c:\php\php.ini from file c:\php\php.ini-recommended file for production server or optionally create from c:\php\php.ini-dist for development server (slow and unsecure configuration for production servers)
- Make some change in php.ini (Enable MySql Extesion, Configure SMTP)
- Following options should be changed (base on php.ini created from php.ini-recommended) create the subdirs if missing.
extension_dir = "c:\php\ext" cgi.force_redirect = 0 cgi.rfc2616_headers = 1 file_uploads = On upload_tmp_dir = c:\php\uploadtemp extension=php_mysql.dll SMTP = localhost smtp_port = 25 sendmail_from = yourname@yourdomain.org session.save_handler = files session.save_path = "c:\php\sessiondata" date.timezone = Europe/Warsaw memory_limit = 32M ; <- Exporting of any pages could be problem with default 8M (see: Special:Export)
-
- Following options could be set optionally
upload_max_filesize = 2M /* <- depends on size you want to upload */
- Add paths PATH and PATHEXT system variables (if it not already added by php setup)
PATH=C:\PHP; ... (this allow to find dlls) PATHEXT: .PHP (this allow to execute from command line)
Right click on My Computer and click properties. Click on Advanced. Click the Environment Variables button. Highlight the path variable in the Systems Variable section and click edit.
- grant IUSR_YOURMACHINENAME modify permissions to C:\PHP\uploadtemp
- grant IUSR_YOURMACHINENAME modify permissions to C:\PHP\sessiondata
- restart IIS using iisreset.exe from command line
[edit] Install MySQL
- get latest package (lastest working is MySQL 5.0.24 - MySQL 2.0.26 is not working and installation is not possible for MediaWiki 1.7.1 and 1.8.1) from [3]
- Use the setup file. Perform a full installation with defaults into any path i.e. C:\Program Files\MySQL.
- Add path to PATH
PATH=C:\Program Files\MySQL; ...
- Check if installation is working
C:\>mysqlshow -u root -p
Enter password: ***********
+-----------+ | Databases | +-----------+ | mysql | | test | +-----------+
[edit] Install MediaWiki on IIS
- Extract MediaWiki into any path i.e. C:\mediawiki
- Open IIS Console and create Virtual Directory on IIS i.e. mediawiki
- Grant the permissions Read & Execute.
- Change the applications configuration for the virdir
(properties/configuration)
- Check if Virtual Directory has the .php extension enabled and that the default document is set to index.php
- Setup should have already configured this, if not, add .php as an extension and define the path to the executable)
- grant IUSR_YOURMACHINENAME modify permissions to C:\mediawiki\images (if you plan uploads)
[edit] Install Cygwin
Try to install some packages from cygwin [www.cygwin.com] to c:\cygwin
-
- diff3 - for versions compare
- convert - for uploaded image conversion
- Comment: I tried the cygwin "convert" variaton. Didn't get it to work. However, it is possible to download a windows version of ImageMagic from ImageMagick Binaries. I used the ImageMagick-6.3.1-7-Q16-windows-dll.exe version. Then, edited LocalSettings.php:
$wgImageMagickConvertCommand = "C:/Program Files/ImageMagick-6.3.1-Q16/convert";
- works like a dream (MediaWiki 1.8.2).
-
- When I was writting this article convert from cygwin was working but in new version cygwin it not works, so it is better to download ImageMagick Binaries.
- --ChameleonRedOne 19:15, 14 February 2007 (UTC)
[edit] Configure MediaWiki
Open Interner Explorer and type [4] (if it is your virtual directory name) - it redirects you to [5].
- IE open configuration page, read carefully options (maybe some documentation) and fill required fields - don't change default option - they are good to start MediaWiki - enable e-mails
If the configuration page complains that it cannot initialise a suitable database driver then look here. In my case I configured IIS 5.1 to use php5isapi.dll and needed to a) remove doc_root from php.ini and b) move php.ini to c:\windows.
At the end of configuration if you grant suitable permission check c:\mediawiki\config for LocalSettings.php, open this file in editor and scan configuration make some changes if you need it.
Options could be for you LocalSettings.php [6]:
- enabling uploads
- image conversion
- copyright rights
- logo
- and so on ...
[edit] Move LocalSettings.php
- Move LocalSettings.php from c:\mediawiki\config to c:\mediawiki.
- Delete or Rename c:\mediawiki\config directory.
- Fix permission to secure state
- IUSR_YOURMACHINENAME read on c:\mediawiki
- IUSR_YOURMACHINENAME write on c:\mediawiki\images (if you plan uploads)
[edit] Patch MediaWiki
Use notepad++ and find all files in c:\mediawiki with string
$_SERVER['REQUEST_URI']
To replace to IIS compatible name of variable
$_SERVER['SCRIPT_NAME']
[edit] Run MediaWiki
Open with Internet Explorer http://localhost/mediawiki (if you not set index.php as default -> http://localhost/mediawiki/index.php)
[edit] Configure SMTP
Install from Windows System Installer additional component called SMTP (it is not installed by default Windows installation)
From IIS Console choose SMTP properties and restrict access for connections only to your computer 127.0.0.1.
Check if SMTP working by follow operations:
- telnet localhost 25
- then type
- HELO + <Enter>
- MAIL FROM: yourname@yourdomain.org + <Enter>
- RCPT TO: yourname@yourmailbox.org + <Enter>
- DATA + <Enter>
- Subject: Hello from my SMTP + <Enter>
- + <Enter>
- Hello, + <Enter>
- I am configured SMTP. + <Enter>
- . + <Enter>
- + <Enter>
- Open you favorite e-mail program and see if mail comes to your (if not check c:\windows\system32\logfiles\... or c:\inetpub\mailroot\drop for the reason)
[edit] Configure PHP SMTP
Set suitable lines in PHP.ini (smtp server, smtp port, smtp e-mail from).
Rember to set time zone in PHP.ini (if it will be not done - e-mail sending fails) i.e. timzone = Europe\Warsaw for more information about your time zone name see php documentation [7].
[edit] Patch MediaWiki SMTP
UserMailer.php -> MediaWiki don't format correctly messages for Windows (Unix need at end of line "\n" but Windows need "\r\n"). Probably in next version of MediaWiki this problem will be solved [8].
Find follow lines in UserMailer.php:
wfDebug( "Sending mail via internal mail() function to $dest\n" );
mail( $dest, wfQuotedPrintable( $subject ), $body, $headers);
restore_error_handler();
and replace to:
wfDebug( "Sending mail via internal mail() function to $dest\n" );
mail( $dest, wfQuotedPrintable( $subject ), str_replace( "\n", "\r\n", $body ), str_replace("\n", "\r\n", $headers ));
restore_error_handler();
Usermailer.php -> IIS don't support full RFC recommedation, so next patch is need (remove additional name in e-mail address:
Usermailer.php ->
Find follow lines in UserMailer.php:
function toString() {
if( $this->name != '' ) {
$quoted = wfQuotedPrintable( $this->name );
if( strpos( $quoted, '.' ) !== false ) {
$quoted = '"' . $quoted . '"';
}
return "$quoted <{$this->address}>";
} else {
return $this->address;
}
}
and remove condition on use nicknamesin e-mail address by commenting out:
function toString() {
// if( $this->name != '' ) {
// $quoted = wfQuotedPrintable( $this->name );
// if( strpos( $quoted, '.' ) !== false ) {
// $quoted = '"' . $quoted . '"';
// }
// return "$quoted <{$this->address}>";
// } else {
return $this->address;
// }
}
[edit] Check if MediaWiki Works with SMTP
- Create account or use WikiSysop to login to mediawiki
- Choose preferences and input your email
- Choose e-mail verification to send link to confirm your e-mail
- If everything works good:
- your will receive information e-mail send
- your will receive e-mail or two e-mails one after registration with invalid link and one after confirmation button selection with valid link
[edit] At The End
If you have some questions please e-mail to me (--ChameleonRedOne 11:34, 29 September 2006 (UTC)), if you have some suggestions or want to improve this article on your experience please insert changes.
[edit] Who help with question and answer
[edit] Global filters
87.250.34.186 12:02, 19 October 2006 (UTC) Darko: What are global filters in this context and where can you configure them?
Exactly, there are not global filters -> that is ISAPI filters on the root directory configuration :) --ChameleonRedOne 19:15, 14 February 2007 (UTC)
[edit] ImageMagic in Cygwin
- Comment: I tried the cygwin "convert" variaton. Didn't get it to work. However, it is possible to download a windows version of ImageMagic from ImageMagick Binaries. I used the ImageMagick-6.3.1-7-Q16-windows-dll.exe version. Then, edited LocalSettings.php:
$wgImageMagickConvertCommand = "C:/Program Files/ImageMagick-6.3.1-Q16/convert";
- works like a dream (MediaWiki 1.8.2).
-
- When I was writting this article convert from cygwin was working but in new version cygwin it not works, so it is better to download ImageMagick Binaries.
--ChameleonRedOne 19:15, 14 February 2007 (UTC)

