MediaWiki Installation on Windows Server 2003 (WAMP) – Part 4 – MediaWiki

Articles in the Series

The next step is installing MediaWiki.

  1. Download the latest version of MediaWiki
  2. Create a new folder in “C:\Program Files\Apache Software Foundation\Apache2.2\htdocs” folder called “MediaWiki”
  3. Extract the MediaWiki files and copy all of the files into the newly created folder. (don’t copy the folder copy the contents!
  4. Create a new database for MediaWiki in MySQL. I called it “MediaWiki”.
    1. Open a commandline by either
      1. Pressing the ‘Windows key’ and the ‘r’ key together and type “cmd” and hit “ok”.
      2. Clicking the start menu and clicking the “Run…” option to the left of the menu and then typing “cmd” and clicking “OK”
    2. Navigate to the “C:\Program Files\MySQL\MySQL Server 5.1\bin” directory (this may depend on the version you are using. We want to MySql bin directory). You can do this by typing cd “C:\Program Files\MySQL\MySQL Server 5.1\bin” ensuring the quotes are around the path as there are spaces! You may be able to just type mysql if it is in the PATH variable, but here I’m assuming that it is not.
    3. Type “mysql -u root -p passwordhere” where passwordhere is the root users password. The mysql commandline tool will come up.
    4. Type “CREATE DATABASE MediaWiki;” and press enter. (Note the ; at the end…. it is important!!!). Please replace MediaWiki with whatever yo want to call the database
    5. Type “quit;” and press enter. You can then close the commandline.
  5. Open a browser and type http://localhost:8080/MediaWiki/index.php and you should be taken to a page that gives you a link to the setup page… The link says “set up the wiki”
  6. If “Environment checked. You can install MediaWiki” is at the bottom of the “Checking environment…” section then fill in the details and click “Install MediaWiki!”
  7. In the “Database config” section set the database name to whatever the database name is, which in this case is “MediaWiki”. Set the username and password to the account that you want MediaWiki to create in MySql. Check the “Superuser account” checkbox and type the root user password in. This will be used to create the database and a user account that MediaWiki will use to connect to the database.
  8. Click the “Install MediaWiki!” button
  9. When the installation is successful go to the “C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\MediaWiki\config” directory (that is the config directory in the MediaWiki files that are stored in the Apache htdocs folder) and copy the “LocalSettings.php” file to the top level MediaWiki directory (I.E. The parent folder of the one the file is in, or “C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\MediaWiki”)
  10. Either click the “this link” link on the installation page or type http://localhost:8080/MediaWiki/index.php and your will should be up

Done! (Hope it is for you also!)

MediaWiki Installation on Windows Server 2003 (WAMP) – Part 3 – PHP 5

Articles in the Series

We are now up to installing PHP. Here is how I installed it using the zip file

  1. Download the latest version of PHP from here. I just get the Zip package of the windows binaries
  2. Create a directory called PHP on the C:\. In this guide I’m going to put it at “C:\PHP”.
  3. Extract all of the contents of the zip file into the PHP directory.
  4. Make a copy of the “php.ini-recommended” file and name it “php.ini”. I tend to leave the file in the C:\PHP directory even though some documentation says to put it elsewhere.
  5. Open the “php.ini” file and look for “doc_root”. Set it to “C:\Program Files\Apache Software Foundation\Apache2.2\htdocs” (Including Quotes). This directory is where the apache files are served from.
  6. In the same file look for “extension_dir”. And set it to “C:\php\etc”. What we are doing here is telling php where the extension dll’s are stored.
  7. In the same file look for a line that says “;extension=php_mysql.dll” and remove the ; from the start. This will tell php to use the MySql extension.
  8. Save the File.
  9. In the “C:\PHP\” there is a file called “libmysql.dll”. Copy it to “C:\Windows\System32”. This is so that PHP can communicate with the MySql server! It essentially puts the dll into a search path and php will use the extension to talk to this dll (I think!)… thus allowing php to communicate with MySql
  10. Go to the “htdocs” folder in the apache install: “C:\Program Files\Apache Software Foundation\Apache2.2\htdocs”
  11. Create a file called “info.php”
  12. Type “<?php phpinfo(); ?>” into the file and save (don’t include the quotes)
  13. Open your Browser and type http://localhost:8080/info.php We are not there yet of course. You should see the text you have typed in the file. We now need to tell Apache to pass .php files to the php processor. To do that navigate to the “conf” folder in the Apache installation -> “C:\Program Files\Apache Software Foundation\Apache2.2\conf”
  14. Open the “httpd.conf” file
  15. Add the following to the file and save it (This essentially tells Apache to let php process the file contents before sending it to the clients browser. PHP will then do it’s processing on the file, pass it back to Apache which will then send the processed file to the browser/user agent.)
# PHP 5 Settings
Loadfile "C:\php\php5ts.dll"
LoadModule php5_module "C:\php\php5apache2_2.dll"
PHPIniDir "C:\php"
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .phps
  1. Restart Apache using the tool in the notification area.
  2. Browse to http://localhost:8080/info.php. instead of the php code you should see a page with a lot of php information on it.
  3. Search the page for the words “MySql”. If it is present then you are set to go!

Now to install MediaWiki!

1. Download the latest version of PHP from here. I just get the Zip package of the windows binaries

2. Create a directory called PHP on the C:\. In this guide I’m going to put it at “C:\PHP”.

3. Extract all of the contents of the zip file into the PHP directory.

4. Make a copy of the “php.ini-recommended” file and name it “php.ini”. I tend to leave the file in the C:\PHP directory even though some documentation says to put it elsewhere.

5. Open the “php.ini” file and look for “doc_root”. Set it to “C:\Program Files\Apache Software Foundation\Apache2.2\htdocs” (Including Quotes). This directory is where the apache files are served from.

6. In the same file look for “extension_dir”. And set it to “C:\php\etc”. What we are doing here is telling php where the extension dll’s are stored.

7. In the same file look for a line that says “;extension=php_mysql.dll” and remove the ; from the start. This will tell php to use the MySql extension.

8. Save the File.

9. In the “C:\PHP\” there is a file called “libmysql.dll”. Copy it to “C:\Windows\System32”. This is so that PHP can communicate with the MySql server! It essentially puts the dll into a search path and php will use the extension to talk to this dll (I think!)… thus allowing php to communicate with MySql

10. Go to the htdocs folder in the apache install: “C:\Program Files\Apache Software Foundation\Apache2.2\htdocs”

11. Create a file called “info.php”

12. Type “<?php phpinfo(); ?>” into the file and save (don’t include the quotes)

13. Open your Browser and type http://localhost:8080/info.php We are not there yet of course. You should see the text you have typed in the file. We now need to tell Apache to pass .php files to the php processor. To do that navigate to the “conf” folder in the Apache installation -> “C:\Program Files\Apache Software Foundation\Apache2.2\conf”

14. Open the “httpd.conf” file

15. Add the following to the file (This essentially tells Apache to let php process the file contents before sending it to the clients browser. PHP will then do it’s processing on the file, pass it back to Apache which will then send the processed file to the browser/user agent.)

# PHP 5 Settings

Loadfile “C:\php\php5ts.dll”

LoadModule php5_module “C:\php\php5apache2_2.dll”

PHPIniDir “C:\php”

AddHandler application/x-httpd-php .php

AddHandler application/x-httpd-php-source .phps

16. Save the file

17. Restart Apache using the tool in the notification area.

18. Browse to http://localhost:8080/info.php. instead of the php code you should see a page with a lot of php information on it.

19. Search the page for the words “MySql”. If it is present then you are set to go!

MediaWiki Installation on Windows Server 2003 (WAMP) – Part 2 – MySql

After installing Apache, the next step is to install MySql (or I’m making that the next step!).

This is really sadly the hardest part (at least when using the Windows Installer) and I came across some annoying little problems.

I’ve included troubleshooting sections after the installation. If you have the service stop or an error dialog while trying to configur the server then refer to those sections.

Articles in the Series

Installing MySql

To install MySql I do the following:

  1. Download the latest version of MySql from here
  2. Run the Executable (Version used in this document is “mysql-5.1.35-win32.msi”)
  3. Click “Run” when security warning dialog comes up
  4. When installer wizard is ready click “Next >”
  5. Ensure “Typical” is selection and click “Next >”
  6. Accept the locations and click “Install”
  7. Click “Next >” a few times when the advertising dialog comes up!
  8. Un-check the “Register the MySql Server now” option and click “Finish”. The installation dialog will close and the configuration dialog will open
  9. Click “Next >”
  10. Select “Standard Configuration” and click “Next >” Please note that you MAY cause issues by using anything but “Standard Configuration” on some systems. So always choose it!
  11. Ensure “Install As Windows Service” is selected and the service name is “MySql”. The “Launch the MySQL Server automatically” option should also be checked.
  12. Click “Next >”
  13. Enter the password in each of the password boxes and click “Next >”
  14. Click “Execute”
  15. Click “Finish”

We are now (Hopefully!) done installing MySql… Issues??? Read on!

Troubleshooting

So you have probems? Here are the ones that I’ve come across and their solutions.

During Configuration the Service Doesn’t Start!

It think this is essentially because the service is already started though I’m not sure. To get around this I do the following

  1. Close the dialog
  2. Run the “MySQL Server Instance Config Wizard” which is located in the start menu
  3. Select the “Reconfigure Instance” option and click “Next >”
  4. Select “Standard Configuration” and click “Next >” Please note that you MAY cause issues by using anything but “Standard Configuration” on some systems. So always choose it!
  5. Click “Next >”
  6. Enter passwords again
  7. Click “Next >”
  8. Click “Execute”. You should now get to the Apply Security settings option
  9. Click “Finish”

Connection Error: Nr. 1045 Access denied for user ‘root’@’localhost’ (using password: No|Yes)

Don’t have a clue why this happens, but this process seems to solve it!

1. Open the my.ini file while the error dialog is still up! File is located in the following directory “C:\Program Files\MySQL\MySQL Server 5.1”

2. Add the following to the bottom of the [mysqld] section of the file (Found this information here originally.) Please note that you will want to configure your firewall to let MySql through!!!

max_allowed_packet = 1M
skip-grant-tables
# table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
myisam_sort_buffer_size = 8M

3. Open a command prompt and type

net stop mysql

4. Then type

net start mysql

5. On the configuration tool error dialog click “Retry” and it should pass and complete successfully.

Reinstalling MySql

Just some notes about reinstallation of MySql. If you run the installer and remove MySql then make sure you remove the data directory.

Usually I remove the following two directories (if using the default paths given in installation)

  • C:\Program Files\MySql\MySQL Server 5.1\
  • C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\

I do this before reinstalling or after removing. I’m not sure yet as to whether there might be some registry settings or other things stored in other places that should be removed!

Next one is PHP!

MediaWiki Installation on Windows Server 2003 (WAMP) – Part 1 – Apache

Update: Added details on setting the default page that shows. Just to remove directory listings

Recently at work we were trying to get MediaWiki installed in a WAMP scenario (Windows, Apache, MySql and PHP). I’m starting this series of posts on the process as there are a few odd little problems that I’ve come across and I wanted to record them along with the whole process for future reference.

Each part of this series installs a required component so generally speaking they should be suitable as individual installation quides and for installation for tools other than MediaWiki

Please don’t have a go at me for installing this stuff on Windows instead of Linux!

Please not that I might come back and put some more details into the instructions and some relevant pictures at a later date. At the current point I don’t have the time, and I hope this is adequate.

Articles in the Series

WAMP Components

The component versions I’m using for the WAMP configuration are:

  • Windows Server 2003 R2
  • Apache 2.2.11 – Using the windows installer
  • MySql 5.1.35 – Using the windows installer… Yes I know I’m insane 😉
  • PHP 5.2.9 – Using the zip package

This post will be on the installation of Apache on the Windows 2003 Server, and assumes that Windows has been setup already.

Installing Apache

I installed Apache on a system that has IIS installed on it already due to the server being used as a test bed for ASP.NET 2.0 applications so I’m going to install apache and change the port it listens on to 8080. I thought i would show the process of how to do this as 1. It’s not hard and 2. It might come in useful to someone who comes across the same issue.

Installation went something like this:

  1. Download the latest version of the Apache from here
  2. Run the Executable (Current version i used for this post was ”apache_2.2.11-win32-x86-openssl.0.9.8i.msi”)
  3. Click “Run” when security warning dialog comes up
  4. When installer wizard is ready click “Next >”
  5. Select the “I accept the terms in the license agreement” radio button and click “Next >”
  6. Click “Next >”
  7. The details are not important in a demonstration site. Please fill the details in if hosting in an important place. Ensure that the “for All Users, on Port 80, as a service – Recommended.” Is the section radio button and click “Next >”
  8. Ensure “Typical” is selected and click “Next >”
  9. Click “Next >” to accept the installation directory… Please make a note of it especially if you change it. This post and future ones in the series assume that you have not changed the installation path.
  10. Click “Install”. You may get an error about using the same port as another server if you have installed it on a server that has IIS installed. We will fix this soon!
  11. Once the installation has finished click “Finish”
  12. Open the “httpd.conf” file (this is the configuration file for apache2! It is in the “C:\Program Files\Apache Software Foundation\Apache2.2\conf” folder if you have kept the default installation path!)
  13. Find the line that starts with “Listen” and change the 80 to 8080. This changes the port that Apache listens on from port 80 to port 8080 obviously.
  14. If you are installing PHP later and MediaWiki, then find the line that starts with “DirectoryIndex” and set the line to “DirectoryIndex index.php index.html”. This will cause Apache to look for the given two files before showing a directory listing… which I happen to not want to have happen.
  15. Save the file
  16. In the start menu find the apache folder and click the “Monitor Apache Servers” You will probably get an error stating that it has already been started. Go to the notification area at the bottom right of the screen on the toolbar and click the apache monitor icon (nearly the same icon as the start menu)
  17. Start/Restart apache!
  18. To test open a browser and type in Http://localhost:8080 and you should have a page come up saying “It works!”

Next we will install MySql…