MS4W - Packaging an MS4W Application
The rationale behind MS4W is that it provides a
pre-configured environment for applications to be installed
into, and that applications are, in turn,pre-configured for
this environment. These instructions will assist in
ensuring that your application is correctly configured and
packaged for MS4W.
You are responsible for pre-configuring any configuration
files and settings that may be required by your application,
including temporary file locations and URLs.
MS4W provides the following built-in temporary file locations:
/ms4w/tmp - file system path to store temporary
/ms4w/tmp/ms_tmp/ - file system path to store temporary
/ms_tmp/ - URL to access temporary web-accessible
MS4W provides the /ms4w/apps/ directory to hold applications.
Your application must be installed in a subdirectory of the
/ms4w/apps/ directory, preferrably with a meaningful name.
MS4W provides the /ms4w/httpd.d/ directory to hold Apache
Alias Files. In general, applications consist of some
web-accessible pages and some other files that should not be
web-accessible. MS4W applications typically include an
'htdocs' directory that would contain the web-accessible
pages of the application. The Apache Alias File
(see below) would then provide a URL directly to this
It is not necessary to have only one web-accessible directory,
but each one should be given an alias in the Apache Alias
File (see below).
The Index Package File provides a small HTML snippet that is
automatically included in the MS4W index page. This HTML
snippet should provide a brief description of your application
and provide links to access the aliases you have provided via
the Apache Alias File. The Index Package File resides in
/ms4w/Apache/htdocs and follows a strict naming convention:
Only files that end in .pkg.html will be included in the
The Apache Alias File provides a convenient mechanism for your
application to provide a URL Alias by which it can be accessed.
The Apache Alias File may contain any valid Apache directives,
but in general it will contain one or more Alias and Directory
directives. An Alias directive tells Apache that a
URL http://localhost/alias/ points at a specific directory, and
a Directory directive tells Apache what privileges to allow
in a specific directory.
In most cases, the following would be sufficient for an
application named 'foobar':
Alias /foobar/ /ms4w/apps/foobar/htdocs/
Options Indexes FollowSymLinks Multiviews
Allow from all
The Apache Alias File is stored in the /ms4w/httpd.d/
directory. This directory is automatically scanned by
Apache when it starts. The name of the file is very
important. Apache will only load files that match the
Normally, you would replace * with your application name. In
the above example, the application would use httpd_foobar.conf
in the /ms4w/httpd.d/ directory. This would allow the user
to connect to http://localhost/foobar/ to access the
Once the application is fully configured and working within
the directory structure of MS4W, it can be packaged as a
ZIP file for distribution.
The package file needs to be carefully set up to make sure
that it does not affect other applications in the user's
installation. In general, you need to include:
It is very important to ensure that the zip file preserves
The name of the zip file should be:
To test your newly created package, you should:
- stop Apache
- rename your existing MS4W folder to some other name
- extract a clean MS4W installation
- extract your application over the MS4W installation
- start Apache
- make sure that Apache doesn't report errors on start up
- open http://localhost/index.phtml and make sure that your
pkg.html file was correctly processed
- test all the aliases from the httpd_foobar.conf file to
make sure they work as expected.
- test your application to make sure that it still works.
Sometimes install notes are needed outside of the
application package (especially if external dependencies
exist), and these can be linked on the MS4W
Downloads page in your application section (for example
see the Mapbender section and it's doc).