Introduction
The benefits of Open Source Software are many and thus it is natural that OSS is increasingly used also on closed platforms, one of them being Microsoft Windows. Many OSS components support several platforms and using the same components on different platforms may ease maintenance and require less effort to complete projects as the same software can be deployed on all used platforms. Some components also offer features that no proprietary software delivers. Reasons to use Microsoft Windows operating system vary but where it is required, it should be relieving to know that numerous OSS components run also on Windows.
This document provides an easy to understand step-by-step guide to configure WAMP: Windows, Apache, MySQL, PHP stack that can used as such or as a platform for other components such as MediaWiki, a popular Open Source Wiki engine. The presented configuration provides a fully functional WAMP stack and MediaWiki as an example application on top of it. Advanced performance configurations or security considerations are not discussed in this document.
Windows Configuration
For Microsoft Windows no changes to default configuration are needed. Naturally it is always recommended to apply available security updates but for WAMP to operate they are not required.
It is worth noticing that if Internet Information Services (IIS) has been enabled it must be disabled before proceeding in order to allow Apache to run on the default HTTP port. If you do not know what IIS is or you have not enabled it you can ignore this notice. Configuring both IIS and Apache to run on the same host is outside of scope of this document.
These instructions have been tested with Windows 2000, Windows XP, and Windows 2003 Server. Other Windows versions can also be used.
MySQL Configuration
To begin MySQL installation, first download latest version of MySQL 5.0 Windows Essentials as an MSI package.
During MySQL installation, select Typical installation and use default configuration values except for Sign-Up where you probably want to select Skip Sign-Up. When Setup Wizard is completed, make sure the option Configure the MySQL Server now is set.
For MySQL Server Instance Configuration, select Standard
Configuration. Next, you must set option Include
Bin Directory in Windows PATH. This setting is crucial,
otherwise a required library, libMySQL.dll
, will not be
found later during Apache startup. Finally, enter a proper root
password. There is no need to neither enable remote root access or
create an Anonymous Account.
Please inspect messages during MySQL startup and verify that MySQL has
been started successfully. Then, you must reboot the
system. Otherwise, the required library libMySQL.dll
will
not be found during Apache startup when Apache is trying to load
Apache's PHP module and
Apache will, perhaps a bit confusingly, complain that it is unable to
load the PHP's MySQL
library, php_mysql.dll
. Therefore, it is necessary to
reboot the system at this stage and then continue to PHP configuration.
PHP Configuration
PHP for Windows must be installed from the zip package, not using the installer because the installer does not work correctly when setting up the configuration files. Download the latest Windows binary version from the 5.x release series.
Create folder C:\Program Files\PHP5
and unzip the
downloaded package there. Then, in folder C:\Program
Files\PHP5
you need to copy the file
php.ini-recommended
as php.ini
and make two
changes into the php.ini
file. Change
extension_dir
to:
extension_dir = "C:/Program Files/PHP5/ext/"
and also uncomment the following line:
extension=php_mysql.dll
That is all what is needed for PHP configuration. Additionally, however, if you
wish to run PHP from
the command line it would be useful to add its installation directory to
Windows PATH
but for WAMP to operate it is not required. After Apache is
installed and configured, also PHP configuration can be tested.
Apache Configuration
Official Apache web site provides also binaries for Windows. Download the latest available MSI package from the 2.2.x release series.
During Apache installation, use default values for all configuration
queries. Make sure, though, that you fill in a valid e-mail address to
Administrator's Email Address
field, otherwise Apache will
fail to start due to a configuration error. After the installation has
finished a tray icon should appear to indicate that Apache server is up
and running.
To configure Apache server edit configuration via a Start Menu item or
open the file C:\Program Files\Apache Software
Foundation\Apache2.2\conf\httpd.conf
in a text editor and change
the following line:
DirectoryIndex index.html
to include index.php
so that the result will look like:
DirectoryIndex index.php index.html
This will cause Apache to serve page index.php
by default,
if present. Then, add into the same file after all the
LoadModule
directives the following lines:
# Enable PHP5 LoadModule php5_module "C:/Program Files/PHP5/php5apache2_2.dll" AddType application/x-httpd-php .php PHPIniDir "C:/Program Files/PHP5"
These lines cause Apache to load and use PHP module and its configuration. The last
directive, PHPIniDir
, is crucial, without it
Apache will fail to read the PHP configuration file.
Apache is now configured. For changes to take effect, Apache must be restarted either from Start Menu or using the Apache Monitor that can be started from the tray icon. No error messages will appear if configuration has been done as instructed.
Before finally proceeding to MediaWiki configuration it is a good idea
to check at this stage that WAMP really is working properly. This can be done simply by
creating file C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\test.php
that contains only the
following line:
<?php phpinfo(); ?>
The result can then be seen by opening the page http://localhost/test.php in a
browser. Make sure that PHP Loaded Configuration File
is C:\Program Files\PHP5\php.ini
and that MySQL has its own
section in the configuration details noting that MySQL support is
enabled. As could be noticed, the default content location,
DocumentRoot
, for Apache to serve content is
C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs
.
At this this stage the WAMP stack is up and running, congratulations!
MediaWiki Configuration
Now that WAMP is up and
running, MediaWiki can be installed.
Download latest stable
release and extract the downloaded package to C:\Program
Files\Apache Software Foundation\Apache2.2\htdocs
. Rename the
extracted folder, e.g., mediawiki-1.13.3
as
wiki
.
MediaWiki configuration is then done simply by surfing to http://localhost/wiki/ and answering to configuration queries. Sufficient help for most queries is available at the configuration page so most of the items are not covered here.
Shared memory caching would provide performance speedup but in this basic configuration, no caching is available. For all e-mail related queries select disabled as needed configuration of other components for e-mail support is outside of scope of this document. Finally, in the Database config section the provided default values are suitable. For the field DB password use a proper password that is different from the MySQL root password that was set during MySQL installation. The previously set MySQL root password must then be entered into the field Superuser password. Note that you must also set the option Use superuser account. For Database charset it is recommended to select Backward-compatible UTF-8.
After hitting the Install! wait a minute until the next
page is loaded. Check that it says Installation successful!
and to finish the configuration move the file
wiki\config\LocalSettings.php
into the parent folder
wiki
as instructed by the installer. To improve security,
the folder C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\wiki\config
should be removed after a
successful installation.
Congratulations, all is now done and your Wiki is ready for use at http://localhost/wiki/.
Conclusion
This document provided simple step-by-step instructions on how to configure WAMP and MediaWiki. There are also dozens of other Open Source applications that could be used on top of WAMP. There are also several additional configuration tweaks to improve both performance and security that could be applied to the presented configuration but they are outside of scope of this document. Customizations could be made to enhance usability and integration to other systems. Typical enhancements to the presented configuration could include SSL support for Apache, LDAP Authentication for MediaWiki, and access restrictions for MediaWiki that could be essential in a corporate environment.
Comments and feedback can be sent to oss(at)segetech.com. We would kindly like to note that we cannot promise a personal reply to all e-mails received, especially to those asking for help in some unrelated configuration problems. Inquiries about possible cooperation should be done via addresses listed at our Contact page.
This document was last updated on 2008-12-14.