Table of Contents
- 1. What should I do if p.mapper is not working correctly?
- 2. How to ask questions on the p.mapper mailing list
- 3. Enable p.mapper debugging
- 5. Problems with character encodings
- 6. Strange characters - encoding problems - in query result
- 7. I get a PHP error when using an attribute query (search) on a PostGIS …
- 8. Query (identify, search, select returns no results
- 9. Test of query strings
FAQ: Problems and debugging
1. What should I do if p.mapper is not working correctly?
- If you are fairly new to MapServer and p.mapper, please read this first.
- Check the PHP error log. All PHP errors and warnings are logged there. Also all error checks and logging implemented in p.mapper are performed via the PHP error logging. If you don't know where to find the PHP error log, read the PHP documentation
- If you don't find any errors, have a closer look at the PHP error log :-). Check the Apache error log.
- since p.mapper 3.1 you should set the debugLevel in config_xyz.xml to 3 and check the output in the same directory as the PHP error log in a file called pm_debug.log that can provide useful information for debugging
- Test the map file with low level tools, e.g. with the shp2img utility (enable debug function) in order to identify generic MapServer! or configuration problems.
- Test the correct functioning of PHP/Mapscript, e.g. using the supplied basic script test_mapfile.phtml like http://myserver/test_mapfile.phtml?mapfile=/home/www/pmapper/config/demo.map
- Test the correct functioning of p.mapper with the demo application and data provided. There are packages for Windows and Debian/Ubuntu? available to allow a set up out-of-the-box.
- Search the p.mapper mailing list archive for similar problems
- Optionally: Consider if the error could be related to a MapServer problem in general. In this case search the MapServer mailing list archive
- If all the above methods do not help you and do not solve the problem:
Post you problems on the p.mapper mailing => see section directly below
2. How to ask questions on the p.mapper mailing list
- the p.mapper version used (e.g. 3.1.0, or development snapshot pmapper-dev from 2007-12-10)
- PHP version; if appropriate, the operating system (Windows, UNIX)
- A clear description of the problem, including where appropriate
- the circumstances under which the problem occurs
- configuration settings in the config_xyz.xml XML file
- code snippets
- parts of the map file (e.g. layer definitions)
- If possible, an online link to the application
- Any additional particular configuration settings (like using a proxy, etc.)
- Use meaningful subjects for your postings to the mailing list. This facilitates the search in the mailing list archive.
- After you solved the problem, please take the time to write a mail back to the mailing list so that others that might experience similar problems can know if the mentioned solution was successful
3) Do not expect any reply to questions that e.g. just say:
- "nothing happens, but there are no errors"
- "the application is not working"
- "I get a blank map/page/no results"
with no further details mentioned as explained above.
3. Enable p.mapper debugging
You can specify a debug level in the config XML file to narrow down potential problems. The debugging function writes debugging info in pm_debug.log in the same directory as PHP error log file; requires php.ini setting error_log to be set to a valid file
0: no debug, just error logging 1: lowest debug level, mainly warnings 3: highest level, various reporting outputs
Internet Explorer: Download the Script Debugger from Microsoft. To enable it you typically have to uncheck the item "Disable Script Debugging" under the menu "Tools - Internet Options - Advanced"
5. Problems with character encodings
p.mapper uses now by default UTF-8 (Unicode) as the recommended encoding scheme to ensure better and easier consistency between all kind of data, data query and data presentation layers. The locale settings are performed via the language_xx.php files in /incphp/locale/. If choosing UTF-8 as encoding scheme these files shall also be UTF8-encoded (which is the default). This requires an editor that supports UTF-8, like Scite.
The locales can be managed for better handling in a database and extracted for the language_xx.php files via a script like extract_locales.php. The current script is set up for SQLite DB's, but can easily be adapted to other DBMS. This script has to be run manually only after updating the database. The provided SQLite 3 database file is already using UTF-8.
There are some caveats, however, related to UTF-8. A problem that might occur especially on some Linux installations and Apache are the default settings for the page encoding in httpd.conf. If set to just AddDefaultCharset on then it will use ISO-8859-1, and eg. the legend/TOC will not be displayed correctly. In this case, modify that setting to AddDefaultCharset utf-8 and it should work fine.
6. Strange characters - encoding problems - in query result
The default character encoding of the pages is UTF-8. In order to ensure correct display of query results from shapefiles the result strings are converted to UTF-8. If the layers are in a different encoding than ISO-8859-1 or WIN1252 (CP1252) - eg. DOS (CP850), UTF-8 encoding of a PostGIS layer, or other ISO encodings - you should specify this as a layer METADATA tag "LAYER_ENCODING" like
METADATA ... "LAYER_ENCODING" "UTF-8" END
7. I get a PHP error when using an attribute query (search) on a PostGIS layer…
PHP Fatal error: Call to a member function project() on a non-object in /xyz/www/pmapper/incphp/map.php on line 642
This error typically appears when the PostGIS layer has different projection definition than the MAP. In this case the DATA tag needs to be changed from "the_geom from mylayer" to
DATA "the_geom from (select the_geom, oid, xyz from mylayer) AS new_tab USING UNIQUE oid USING SRID=4258"
8. Query (identify, search, select returns no results
The query functions identify, select or result return no records for a certain layer. The return message is "No records found" if no records are returned at all by the activated layers.
Check the settings for the layer(s) in the map file. The layer needs to have a TEMPLATE tag with an arbitrary value. Like
LAYER ... TEMPLATE void ... END
If the TEMPLATE tag is not set MapServer does not recognize the layer as "queryable" and returns no results.
9. Test of query strings
Download the script test_query_string.php. Check the pm_debug.log (see item 1. above) for the applied query string. Read the short description in the script and modify the required variables accordingly. Then run the script from the command line
or from an editor that supports direct script execution.