wiki:DocQuickinstallFive

TOC?

Quick install instructions for p.mapper 5.x

For more detailed documentation see the p.mapper manual

Quick install instructions for older version 3.x see PDF file here

PHP Settings

PHP/MapScript Library and WebServer

p.mapper in the current version requires PHP 5. If you want to run p.mapper on PHP 4 you need to use the older version 3.0.

Install the PHP/MapScript library in the appropriate place and configure your webserver to parse *.php and *.phtml files with PHP.

See the documentation for PHP/MapScript and MapServer for details.

LIBICONV

PHP needs to be compiled with support of the ICONV library. This should be the default on Windows and Unix versions of PHP

PHP.INI

In PHP 5.3+ the PHP MapScript extension php_mapscript.so/.dll cannot be loaded any more dynamically. You need therefore to load the extension via the php.ini like

  extension=php_mapscript.so

On Debian-based distribution PHP extensions can be loaded in the Apache style using

$ php5enmod mapscript

which simply drops a symbolic link to /etc/php5/mods-available/mapscript.ini in /etc/php5/apache2/conf.d

Under section [PHP] for Error handling and logging set

error_reporting = E_ALL & ~E_NOTICE        ;;;IMPORTANT!!!
log_errors = On
error_log = ...: Set a valid file name writable by the webserver user. IMPORTANT!!! 

See the PHP Manual for more details.

The application uses PHP sessions to store user settings during the session. Modify the php.ini file to the following settings below section [Session]:

session.save_path = ... : Set a valid path writable by the webserver user
session.use_trans_sid = 0 : set to 0 in order to be compliant with W3C XHTML Strict 
session.auto_start = 0

Using cookies for sessions

In most cases it is recommended to disable the usage of cookies for session handling. You achieve this by the following setting

session.use_cookies = 0

For a more detailed discussion about this setting please see the FAQ

Settings for security

As with all PHP installations it is strongly recommended to disable both register_globals and allow_url_include (allow_url_fopen before PHP 5.2) to avoid potential cross side scripting attacks:

 register_globals = Off

 allow_url_include = Off

Note that register_globals is set to Off by default and its dangerous activation needs an active input by the system admin. Since v3.2 there are additional checks to prevent code insertion in case of very weak PHP security settings that are against any http://www.php.net/manual/en/security.globals.php recommendations. v4 will and wrire out a warning and will not start if these settings are active.

Download PMapper5 from svn

In your Apache root run

svn co http://svn.pmapper.net/repos/pmapper/trunk/pmapper5 pmapper5

Download PMapper5 demodata

PMapper5 comes with a demo mapfile (config/default/pmapper_demo.map) which references a basic set of layers from Natural Earth dataset https://github.com/nvkelso/natural-earth-vector. Inside your demodata dir run:

# yes, you can use svn to checkout from GitHub
svn checkout https://github.com/nvkelso/natural-earth-vector/trunk/10m_cultural/
svn checkout https://github.com/nvkelso/natural-earth-vector/trunk/10m_physical/

those two folders contain the majority of referenced layers in pmapper_demo.map Adjust pmapper_demo.map SHAPEPATH parameter to point the demodata dir.

Application settings

config/config_default.xml The main configuration for p.mapper is set under the subdirectory config in the file config_default.xml. Adapt following mandatory settings to your environment:

<pmapper>

<metadataPrefix> An arbitrary prefix which PMapper5 will check in mapfiles METADATA section (see [http://mapserver.org/mapfile/layer.html]) 
for name/value pairs to be used in query results and layer descriptions.
Eg.
      "PM_DESCRIPTION" "Cities"
      "PM_RESULT_FIELDS" "NAME, ISO2_CODE, POPULATION, GTOPO30"
      "PM_RESULT_HEADERS" "Name,Country,Inhabitants,Altitude"
      "PM_RESULT_HYPERLINK" '{ "NAME": {"alias": null}, "ISO2_CODE": {"alias":"Link on Country"} }'
      "PM_LAYER_ENCODING" "UTF-8"

<map>

<mapFile>  Map file location; 2 possibilities:
  1) use absolute path to map file in file system (use slashes instead of backslashes)
  2) filename only, if map file is under the directory specified at 'pm_config_location' 
<categories>
    <category name="cat_admin" description="Administrative" imgFormat="png32" olTheme="admin" buffer="0" themeType="PMTile">
        <group>countries</group>
        <group>admin</group>
        <group>cities10000eu</group>
        <group olTheme="urbanthm" imgFormat="png8" name="urban"></group>
        ...
    </category>
    ...
</categories>

The "name" attribute of a category is used like a variable and cannot have spaces. The display name in the application view is defined in the "description" tag. As a general rule, Layer and group names must not have spaces.

Usage of categories in the TOC requires to set this below

<ui>

<useCategories>1</useCategories>

<locale>

If the language of your p.mapper application uses non-ASCII characters you must use UTF-8 as character encoding for your web page. Define this via the tag

<defaultCharset>UTF-8</defaultCharset>

Make also sure that your web server has UTF-8 set as default encoding since otherwise not all browsers will understand the encoding correctly.

Other settings

Directory /images/legend/

Important: This directory must be writeable for the user that runs the web server (used for automatic update of legend icons), otherwise the application will not run.

On a Debian system this could be achieved with the commands

chown -R www-data /var/www/pmapper_demo/images/legend/
chmod 755 /var/www/pmapper_demo/images/legend/

On Windows and IIS set the directory security properties to 'Modify' for user IUSR_hostname

Demo data

You can download the demo dataset (pmapper-demodata-3.zip) and test p.mapper with the supplied map file pmapper_demo.map.

Map file

in pmapper_demo.map adapt settings for

MAP
  SHAPEPATH 
  (FONTSET) 
  (SYMBOLSET)
 
WEB
  IMAGEPATH 
  IMAGEURL

The directory defined for IMAGEPATH must be writeable by the web server user (see above). Eg.

chown www-data /home/www/tmp
chmod 755 /home/www/tmp

It is recommended to use an absolute path to avoid problems with relative path resolution. In any case one usually has only one single tmp directory for a web server, so this is a quite stable setting.

Layer and group names must follow rules of variable naming in most programming language. Therefore they

  • must not have spaces
  • shall not start with a number
  • shall contain only the standard 26 latin alphabet characters, numbers or and underscore

Start p.mapper

Starting p.mapper can be done via the index.phtml.

If you have problems with Apache complaining about phtml extension then add index.phtml to /etc/apache2/mods-enabled/dir.conf

<IfModule mod_dir.c>
        DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm index.phtml
</IfModule>

Pre-prepared packages - MS4W and Debian/Ubuntu?

Actually none.

Last modified 2 years ago Last modified on Nov 18, 2014, 6:41:27 PM