wiki:ConfigureGuide22Windows

Configure MapGuide Web Extensions 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 extension to Apache, or Tomcat, or IIS

Apache and PHP downloaded from Internet have to be built with Visual Studio 2008 to be compatible with mapguide.

IIS 7.x

Install IIS 7.x to Windows 7 or Windows 2008 Server

By default, IIS 7 is not enabled under either Windows 7 or Windows 2008 Server.

How IIS feature is enabled under Windows XP/7 or Windows Server is different.

To eanble this feature under windows 7, go to Control Panel->Programs->Turn Windows Features On or Off, in the poped up Windows Features, expand Internet Information Services, check WWW Services, click OK to install the selected features.

Under Windows 2008 Server, go to Control Panel->Administrative Tools->Server Manager, in the left panel, select Role, in the right panel, click Add Roles->Server Roles->Web Server(IIS), click OK to add the selected Role, then in the left panel, select Feature, in the right panel, click Add Features, a window with available windows features should open. Find Web Server (IIS) Tools and check it, click OK to install this feature.

PHP

Create registry key IniFilePath.

To configure IIS with PHP, IIS needs to know where "php.ini" is. IIS gets to know the location of this file through a registry entry, which is HKEY_LOCAL_MACHINE->SOFTWARE->PHP->IniFilePath with string value c:\php\, suppose PHP is installed under c:\php. If PHP is installed with Windows installer, the registry entry is created automatically, otherwise, this key needs to created manually.

If you have multiple PHP installed, it might be tricky to tell IIS which PHP to use, which is beyond the scope of this document. Please refer to this site for information about IniFilePath.

Open IIS Manager by going to Control Panel->Administrative Tools->IIS Manager

Note: We won't explain how to open GUI for the following actions here as it might be different under various windows versions, here we only list the values of the fields in GUI

  1. Create Application Pool.
    Name: MapGuideAppPool  
    .NET Framework Version: (what ever version available in the drop down list)
    Pipeline Mode: Integrated
    Start Application Pool Immediately: true
    
  2. IIS configuration has several levels, the topmost levle is Server(or Host), then Sites, Virtual Directory, Applications. The configuration of lower level can inherit from its parent level. As a demonstration, we only configure Server level in our mapguide example. In the left panel, select what every your machine name is, there should be a list of configuration categories in the right panel. The minimum configurations are Handler Mapping, ISAPI and CGI Restrictions

Bear in mind that if you configure IIS on Server level, all your applications deployed to IIS will have the same configuration, which might not be what you want. So please carefully design your IIS configuration such as which configuration should be on Server level, which on Virtual Directory level. General rule is to put the shared common configuration to Server level, while finely tune each application by configuring the virtual directory level.

  1. Handler Mapping->Add Module Mappings, add the following module mappings
    • FastCGIModule
      requiest path: *.php
      module: FastCGIModule
      executable: C:\php\php.exe
      Name: PHP <version>
      
    • ISAPIModule
      request path: *.php
      module: IsapiModule
      executable: c:\php\php5isapi.dll
      name: PHP ISAPI Handler
      
  2. ISAPI and CGI Restrictions. Add the following restrictions:
    • Map Agent ISAPI Handler
      ISAPI or CGI Path: c:\mapguide-2.2-beta1\Web\www\mapagent\isapi_MapAgent.dll
      Description: MapGuide MapAgent ISAPI Handler
      Allow Extension Path To Execute: True
      
    • PHP ISAPI Handler
      ISAPI or CGI Path: c:\php\php5isapi.dll
      Description: PHP ISAPI Handler
      Allow Extension Path To Execute: True
      
  1. Add Applications to Default Web Site. Right-click Default Web Site->Add Application
    Alias: mapguide
    Application Pool: MapGuideAppPool
    Physical Path: c:\mapguide-2.2-beta1\Web\www
    

Note: Some binary PHP installer may not have php5isapi.dll, you can always find a compatible one for your PHP from the internet. Here is a place to get this file for PHP 5.3.x-x64

ASP.NET

Make sure ASP.NET feature is enabled by going to Control Panel->Programs->Turn windows features on or off. MapGuide requres .NET framework 2.0 or above and ASP.NET 2.0 or above. Refer to this page to check if ASP.NET and what version is installed on your system.

  1. Download dotnetviewersample from Here and extract it to c:\mapguide2.2-beta-1\Web\www\
  1. Copy all DLL from c:\mapguide2.2-beta-1\Web\www\mapviewernet\bin to c:\mapguide2.2-beta-1\Web\www\dotnetviewersample\bin
  1. Open IIS manager, navigate to Default Web Site/mapguide, convert or add mapviewernet and dotnetviewersample into Application
  1. Start mgserver first
  1. open browser to http://localhost:8008/mapguide/dotnetviewersample/ajaxtiledviewersample.aspx

Apache2

Note If you are using Apache as the web server, please refer to Apache Documentation about its configuration.

  1. Download and Install Apache2.2.16 for Windows from Here. Unzip the downloaded file to anywhere, in this document, we unzip it to c:\Apache2

apache.org does not publish any builds for 64-bit machines, try this site to obtain a binary 64-bit build.

  1. Download PHP 5.3.2 or latest version, if your Apache is 64-bit, PHP must be 64-bit too. Follow this instruction to install and configure PHP as an Apache module.
  1. in php.ini, find the following line and edit their values
    extension_dir = "ext"
    extension = php_MapGuideApi.dll
    extension = php_MapGuideApiEnvConfig.dll
    

  1. 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/Web/www"
    <Directory "c:/mapguideopensource-2.2/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]
    </Directory>
    

Note 1: mod_mgmapagent is the module name for mapguide agent, which is hardcoded in source code, so it can't be anything else

  1. start apache http server
    cd <apache bin folder>
    httpd.exe --help
    httpd.exe -k install 
    httpd.exe -k start
    
  1. Troubleshooting
  • visit this site for common apache errors
  • HTTP 403: you don't permission to /mapguide/mapadmin/login.php or anything site under /mapguide/<blabla> : 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
    
  1. Web Tier Test

A web tier test suite is available 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.

Tomcat

Apache does not have JSP/Servlet containers, tomcat can be configured to work with Apache to process the jsp/servlet request, i.e. Apache receives the JSP request and redirect to Tomcat for processing.

(Deploying MapGuide to Tomcat is only supported via Apache HTTP Server for now.)

  1. Download and install Tomcat
  2. Download Apache Tomcat connector (mod_jk)
  3. Configure Apache following the instruction Here
Last modified 12 years ago Last modified on 02/06/13 13:31:30

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.