Problems with Displaying a Map (PHPMapScript)

Pagurek,Debbie [NCR] Debbie.Pagurek at EC.GC.CA
Thu Nov 30 06:35:04 PST 2006


I think the IMAGEURL "C:/ms4w/tmp/ms_tmp/" in your mapfile is incorrect. It should probably read: IMAGEURL "/ms_tmp/". This is the URL that you would use to find the image, not the file location.

D. Pagurek 

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On Behalf Of Karin Kampitsch
Sent: Thursday, November 30, 2006 4:08 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: [UMN_MAPSERVER-USERS] Problems with Displaying a Map (PHPMapScript)

Dear List,

I want to display my mapfile "wkwms.map" in the internet explorer, but unfortunately there exists some problems.
I use Apache Version 2.2.3 , MapServer 4.10.0 and PHP 5.2.0.

The Code PHP/Mapscript of "wanderkarte.php" looks like this.

<?php

dl ("php_mapscript.dll");

$map_path="/ms4w/Apache/htdocs/maps/";
$map_file = "wkwms.map";
$map = ms_newMapObj($map_path.$map_file);        

$map->selectOutputFormat("png");
$image=$map->draw();
$image_url=$image->saveWebImage();

?>

<HTML>
 <HEAD>
    <TITLE>Example 1: Displaying a map</TITLE>  </HEAD>
  <BODY>
    <IMG SRC=<?php echo $image_url; ?> >
  </BODY>
</HTML>



When i want to call the url: http://localhost/maps/wanderkarte.php, the following error message appears.

selectOutputFormat("png"); $image=$map->draw(); $image_url=$image->saveWebImage(); ?>  > 


In the the error.log of Apache: the following message appears:
"The given path misformatted or contained invalid characters: Cannot map GET /maps/<?php HTTP/1.1 to file, referer: http://localhost/maps/wanderkarte.php"

The web section in the mapfile "wkwms.map" looks like this:
TEMPLATE "index_wms.html"
IMAGEPATH "C:/ms4w/tmp/ms_tmp/"
IMAGEURL "C:/ms4w/tmp/ms_tmp/"

The Alias Section in the httpd.conf file looks like this:

Alias /ms_tmp/ /ms4w/tmp/ms_tmp/

<Directory "/ms4w/tmp/">
    AllowOverride None
    Options All
    Order allow,deny
    Allow from all
</Directory>


I really do not know, what path could be missing or is incorrect! I also tried to put other Alias, but this also did not work.

First I did not had "$map->selectOutputFormat("png");" in the php-file.
The error message before adding the selectOutputFormat was:
$image=$map->draw(); $image_url=$image->saveWebImage(); ?>  > 

Has anybody an idea? This would be very nice!

Regards, 

karin


--
"Ein Herz für Kinder" - Ihre Spende hilft! Aktion: www.deutschlandsegelt.de Unser Dankeschön: Ihr Name auf dem Segel der 1. deutschen America's Cup-Yacht!



More information about the MapServer-users mailing list