= Deploy !MapGuide Web Application to Web Servers on Windows =
this document is written with 64-bit windows 7 machine as the testing platform, the process may be slightly different under windows xp. Web applications are refered in mapguide project as web extensions, but they are really the same thing.
Under windows, you have the options to deploy mapguide web application to either Apache, or Tomcat, or IIS
Basic knowledge of 32bit vs 64bit machine: 32bit applications work on 64bit machine, not the other way. 32bit application does not get along with 64bit application if they have to work together. So when downloading Apache or other applications, bear in mind they have to be compatible with either hardware or software. Confused? then ignore what I say :)
== Apache2 ==
'''Note''' If you are using Apache as the web server, it is assumed that you should know how to configure apache with an web application, otherwise, please read [http://httpd.apache.org/docs/2.2/ Apache Documentation] first.
1. Download and Install Apache2.2.16 for Windows from [http://www.apachelounge.com/download/ Here]. Unzip the downloaded file to anywhere, in this document, we unzip it to c:\Apache2
Apache is also available under svn/mgdev/Oem/LinuxApt, which can be copy and pasted to anywhere, but do this only if you know what you are doing. apache.org does not submit any build for 64-bit machines, try [http://www.blackdot.be/?inc=apache/binaries this site] to obtain a binary 64-bit build.
2. Download PHP 5.3.2 or latest version, if your Apache is 64-bit, PHP must be 64-bit too. Follow [http://www.thesitewizard.com/php/install-php-5-apache-windows.shtml this instruction] to install and configure Apache to work with PHP
3. in php.ini, find the following line and edit their values
{{{
extension_dir = "ext"
extension = php_MapGuideApi.dll
extension = php_MapGuideApiEnvConfig.dll
}}}
4. add the following lines to httpd.conf, suppose PHP is installed under c:\php, and !MapGuide libraries are copied to c:\php\ext
{{{
LoadFile "c:/php/ext/ACE.dll"
LoadFile "c:/php/ext/GEOS.dll"
LoadFile "c:/php/ext/MgFoundation.dll
LoadFile "c:/php/ext/MgGeometry.dll"
LoadFile "c:/php/ext/MgHttpHandler.dll"
LoadFile "c:/php/ext/xerces-c_2_7.dll"
LoadModule mod_mgmapagent modules/mod_mgmapagent.so
Alias /mapguide "c:/mapguideopensource-2.2-beta1/Web/www"
AllowOverride All
Options All
Order allow,deny
Allow from all
AddHandler php5-script .php
AddHandler mgmapagent_handler fcgi
RewriteEngine on
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L]
}}}
'''Note 1:''' '''mod_mgmapagent''' is the module name for mapguide agent, which is hardcoded in source code, so it can't be anything else
4. start apache http server
{{{
cd
httpd.exe --help
httpd.exe -k install
httpd.exe -k start
}}}
5. Troubleshooting
* visit [http://tud.at/programm/apache-ssl-win32-howto.php3 this site] for common apache errors
* ''HTTP 403: you don't permission to /mapguide/mapadmin/login.php'' or ''anything site under /mapguide/'' : this error means your access setting in apache config file is wrong.
* Login to mapguide admin site error: '''Fatal error: Call to undefined function !MgInitializeWebTier() in C:\mapguideopensource-2.2-beta1\Web\www\mapadmin\login.php on line 70''', this might be caused by the interference of existing php.ini. under windows command line, type '''regedit''' to bring up the registry window, find PHP entry and find out where the php installation is, copy php.ini to !Web/Php/ and edit the value of property '''extension_dir''' accordingly
* browser opens to the source code of php file instead of a web page: this error means Apache is not configured correctly to use PHP.
* 64-bit PHP 5.3.2 may have an issue with php5apache2_2.dll, if so, configure PHP to run with Apache as a CGI binary following the link in step 2
* if no map is showing, but menu bar and title are displayed, it might be that apache didn't pick up the environmental variable MENTOR_DICTIONARY_PATH, check if this variable is set first, then add the following directive to httpd.conf
{{{
PassEnv MENTOR_DICTIONARY_PATH
}}}
6. Web Tier Test
there is a built-in web tier test suite under mapagent. To start, open a browser to !http://localhost:8008/mapguide/mapagent/index.html, click Resource->!EnumerateResources, enter a type name, (for example, !MapDefinition), a login window should pop up, enter Administrator/admin, click Ok, the page should display the information for the specified resource type.
7. Further Adventure
follow the similare concept to configure Apache to work with java/jsp viewer
== Tomcat ==
Deploying !MapGuide to Tomcat is only supported via Apache HTTP Server for now.
== JBoss ==
In theory, a web application should be able to be deployed to any web server with some instrumentation. We never tried to deploy !MapGuide Web App to JBoss, so this might be a future work if there is request for it.
=== IIS ===