NapGen Installation

MapServer for Windows (MS4W) 3.0.3 Installation (for Windows XP or Windows 7)

MS4W includes an Apache HTTP server that can serve up NapGen's web applications.

Note: Microsoft's SQL Server driver for Windows XP does not support the PHP used in the more recent versions of MS4W. Therefore, to install NapGen on Windows XP, you need to install an early version (e.g. 3.0.3) of MS4W. That version can also be installed onto Windows 7.

Here are the steps setting up MS4W:

  1. Install the MS4W version of Apache HTTP server
    1. Download the MS4W 3.0.3 installer
    2. Run the installer

      Note: If the installer is on a shared network drive, the installer may give an error about failing to create a socket for download. Move the installer to a local drive and run the installer from there.

      1. In the "Installation Folder" dialog box, for "Destination Root", enter a directory (e.g. c:\bin). This will cause MS4W to be installed onto a location such as c:\bin\ms4w.
      2. In the "Apache Port" dialog box, accept the default of port 80.
    3. Verify that the Apache server is running by going to http://localhost.

      You should see a page with a title saying something like MS4W - MapServer 4 Windows - version 3.0.3

      If nothing shows up, it may be that port 80 is already in use. Use the DOS command netstat -noa to find out which process or software is using that port.

    4. Move MS4W's htdocs directory to a different location so that upgrading MS4W later won't wipe out or overwrite that directory.

      Note: The MS4W uninstaller ms4w-uninstall.exe also wipes out the htdocs directory.

      1. Create a data folder for Apache (e.g. c:\data\ms4w\Apache).
      2. Move the MS4W installation's htdocs folder to the newly created Apache data folder (e.g. move c:\bin\ms4w\Apache\htdocs to c:\data\ms4w\Apache).
      3. Edit Apache's HTTP server configuration file (e.g. c:\bin\ms4w\apache\conf\httpd.conf).
      4. Look for all (two) instances of htdocs references (e.g. C:/bin/ms4w/Apache/htdocs) and replace them with a path to the data folder (e.g. c:/data/ms4w/Apache/htdocs).
      5. Configure the folder (napGen_output) that will hold the XML files generated by NapGen.
        1. Look for the line </Directory> (without quotes)
        2. Insert the following text block afterward (note: check that the directory path is valid):
          <Directory "c:/data/ms4w/Apache/htdocs/napGen_output">
              Options Indexes FollowSymLinks
          
              <IfModule mod_autoindex.c>
                  IndexOptions FancyIndexing
                  IndexOptions SuppressIcon
          
                  AddDescription "Metadata XML" *.xml
          
                  IndexOptions IgnoreCase FoldersFirst NameWidth=60 DescriptionWidth=*
                  IndexOrderDefault Ascending Date
          
                  ReadmeName /lib/dirListingFooter.html
              </IfModule>
          
              AllowOverride None
              Order allow,deny
              Allow from all
          </Directory>
          
      6. Save the change
      7. Restart Apache
        1. Go to the Windows service display:
          start> Settings> Control Panel> Administrative Tools> Services
        2. Right click on the "Apache MS4W Web Server" line and select "Restart".
  2. Copy the distribution's napGen folder to Apache's htdocs (e.g. c:\data\ms4w\Apache\htdocs).
  3. Configure the PHP on Apache
    1. Go to http://windows.php.net/downloads/releases/archives and download the .zip file corresponding to the version of PHP that comes with the MS4W Apache HTTP server.

      Note: To determine the proper .zip file to download, use http://localhost/napGen/util/phpinfo.php to get the PHP version and the compiler associated with your particular version of MS4W. For instance, MS4W 3.0.3 comes with PHP 5.3.6 and that PHP was compiled using MSVC9. Therefore, the .zip file to download for a 32-bit Windows is php-5.3.6-Win32-VC9-x86.zip.

    2. Open up the .zip file and navigate to the folder ext. In there, you will find the file php_xsl.dll. Copy that file to PHP's extension folder (e.g. c:\bin\ms4w\Apache\php\ext).
    3. Edit PHP's initialization file php.ini
      1. Open php.ini (e.g. c:\bin\ms4w\Apache\cgi-bin\php.ini).
      2. Disable output buffering.
        1. Look for the line:
          output_buffering = 4096
        2. Change it to:
          output_buffering = Off
      3. Increase socket timeout.
        1. Look for the line:
          default_socket_timeout = 60
        2. Change it to:
          default_socket_timeout = 600
      4. Enable XSLT processing.
        1. Look for the line:
          ;extension=php_xsl.dll
        2. Remove the leading semicolon (;) so that the line becomes:
          extension=php_xsl.dll
      5. Set your timezone.
        1. Look for the line:
          date.timezone = "UTC"
        2. Change "UTC" to your timezone (e.g. "America/Toronto"). For a list of the valid timezones, see:
          http://www.php.net/manual/en/timezones.php
      6. Save the change.
  4. Install PEAR for the PHP on Apache
    1. Define the environment variable PHP_PEAR_SYSCONF_DIR (this tells PEAR where to keep its configuration file)

      Note: Unless PHP_PEAR_SYSCONF_DIR is defined, PEAR will try to keep its configuration file in c:\windows. However, depending on the particular installation of Windows, PEAR may not be able to do that. When it can't, PEAR won't complain. But it may fail to install packages or the installed packages may not work.

      1. Bring up Window's System Properties window:
        start> Settings> Control Panel> System
      2. Click on the Advanced system settings link on the left.
      3. Click on the Advanced tab
      4. Click on the Environment Variables button.
      5. Under System variables, click on the New... button.
      6. For Variable name:, enter PHP_PEAR_SYSCONF_DIR.
      7. For Variable value:, enter the path to the above created PEAR directory (e.g. c:\bin\ms4w\Apache\php\pear).
      8. Click OK and again for the next two dialog boxes.
    2. Define the environment variable PHP_BIN
      1. Bring up Window's System Properties window:
        start> Settings> Control Panel> System
      2. Click on the Advanced system settings link on the left.
      3. Click on the Advanced tab
      4. Click on the Environment Variables button.
      5. Under System variables, click on the New... button.
      6. For Variable name:, enter PHP_BIN.
      7. For Variable value:, enter the path to PHP's executable (e.g. c:\bin\ms4w\apache\cgi-bin).
      8. Click OK and again for the next two dialog boxes.
    3. Download the PEAR installer
      1. Create a PEAR directory (e.g. c:\bin\ms4w\Apache\php\pear)
      2. Go to http://pear.php.net/manual/en/installation.getting.php
      3. You will see a paragraph starting with the statement:
        To update your PEAR installation, request http://pear.php.net/go-pear.phar in your browser and save the output to a local file go-pear.phar.
      4. The text http://pear.php.net/go-pear.phar is a link. Click on it to download go-pear.phar into the PEAR directory created earlier (e.g. c:\bin\ms4w\Apache\php\pear).
    4. Run the downloaded go-pear.phar
      1. Start a DOS command window.
      2. Change the default directory to the PEAR directory (e.g. cd \bin\ms4w\Apache\php\pear)
      3. Run go-pear.phar (e.g. c:\bin\ms4w\Apache\cgi-bin\php.exe go-pear.phar)
        1. For the prompt, Are you installing a system-wide PEAR or a local copy?, enter local.
        2. For the prompt Please confirm local copy by typing 'yes', enter yes.
        3. For the prompt 1-12, 'all' or Enter to continue, enter 12. That will bring up a folder window. In that window, navigate to folder containing the PHP executable (e.g. c:\bin\ms4w\Apache\cgi-bin) then click OK.
        4. The prompt 1-12, 'all' or Enter to continue, will display again. This time press the Enter key.
        5. For the prompt Would you like to alter php.ini <C:\bin\ms4w\Apache\cgi-bin\php.ini>? [Y/n], press the Enter key.

          Note: If you get an error saying php.ini cannot be modified, follow the displayed instructions to update php.ini manually.

    5. Verify that the required PEAR packages HTTP_Request2 and Net_URL2 are in fact installed.
      1. Run the DOS command:
        pear list
      2. In the output, look for lines starting with HTTP_Request2 and Net_URL2. They indicate that the associated packages have been installed with the initial PEAR installation.

        If they are not already installed, execute the following DOS commands (and do a pear list check again):

        1. pear install -a Net_URL2-0.3.1
        2. pear install -a http_request2-2.0.0beta1
  5. Install the Microsoft SQL Server driver for PHP
  6. Install the Oracle driver for PHP
    1. Install Oracle's instant client
      1. Go to http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html and click on the link Instant Client for Microsoft Windows (32-bit) to download the zip file.
      2. Open up the zip file and extract the folder instantclient_11_2 to a local drive (e.g. c:\bin\instantclient_11_2).
      3. Add the local path of instantclient_11_2 to the Windows environment variable PATH.
        1. Bring up Window's System Properties window:
          start> Settings> Control Panel> System
        2. Click on the "Advanced system settings" link on the left.
        3. Click on the "Advanced" tab.
        4. Click on the "Environment Variables" button.
        5. Under "System variables", look for the entry for "Path" and click on it.
        6. Click on the "Edit..." button
        7. In the "Variable value:" box, append the local path of instantclient_11_2, preceded by a semicolon (;) (e.g. ;c:\bin\instantclient_11_2).
        8. Click OK and again for the next two dialog boxes.
    2. Install the Oracle driver that will access the instant client.
      1. Open the PHP-specific zip archive downloaded earlier when configuring PHP.
      2. Navigate to the folder ext. In there, you will find the file php_oci8_11g.dll.
      3. Copy php_oci8_11g.dll to PHP's extension folder (e.g. c:\bin\ms4w\Apache\php\ext).
    3. Edit PHP's initialization file php.ini to load the Oracle driver.
      1. Open php.ini (e.g. c:\bin\ms4w\Apache\cgi-bin\php.ini)
      2. Look for the line:
        ;extension=php_oci8_11g.dll
      3. Remove the leading semicolon (;) so that the line becomes:
        extension=php_oci8_11g.dll
      4. Save the change.
  7. Restart Apache
    1. Go to the Windows service display:
      start> Settings> Control Panel> Administrative Tools> Services
    2. Right click on the "Apache MS4W Web Server" line and select "Restart".
  8. Verify that NapGen is running by going to http://localhost/napGen