Warning: Failed to open map file

Pericles S. Nacionales nacional at CBS.UMN.EDU
Sun Jul 17 13:34:14 EDT 2005


Shashi,

Look at your IMAGEURL.  The value for that keyword is the temp path relative 
to the web server's root (http://localhost in your case)--it should just be 
"/tmp/".  While this will probably work on your application, it's not 
recommended.  Also, your IMAGEPATH value is lacking the extra slash "\" at 
the end.

One more thing, if all your MapServer related files are in the same hard disk 
(C:), you don't need to specify the drive letter.  You'll also be better off 
using the Unix slash "/" instead Windows' "\".  The idea is that you can port 
your mapfile to either Windows and Linux/Unix/OSX without having to change 
the paths.  For example, your IMAGEPATH should be rewritten from 
IMAGEPATH "C:\ms4w\tmp\ms_tmp\"
to 
IMAGEPATH "/ms4w/tmp/ms_tmp/".  Now if you move your application from Windows 
to Linux (or the other way around), you won't have to change anything unless 
your files are stored in different hard drive partitions on Windows.

Anyway, it's probably the IMAGEPATH and IMAGEURL in your mapfile that's 
causing the problem.

Good luck!
-Perry


On Sunday 17 July 2005 02:28, Shashi Gireddy wrote:
> I installed ms4w on my windows xp (professional & home both)
> machienes. I had a simple program to display a map, It was working
> fine on Linux, When I tested on windows it is giving me following
> error.
>
> Warning: [MapServer Error]: msLoadMap(): (C:\ms4w
> mp\ms_tmp\Newcounty.map) in C:\ms4w\apps\maps\map1.php on line 15
>
> Warning: Failed to open map file C:\ms4w mp\ms_tmp\Newcounty.map in
> C:\ms4w\apps\maps\map1.php on line 15
>
> Fatal error: Call to a member function on a non-object in
> C:\ms4w\apps\maps\map1.php on line 160
>
>
> I thought it was a windows security issue, I granted "full control"
> permission to almost every available user on the advanced tab. It
> seems it is not a security issue.
> can any body help me.
>
> here is the map file
>
> MAP
>     NAME FIRSTMAP
>     SIZE 500 500
>     STATUS ON
>     SYMBOLSET "c:\ms\symbols\symbols35.sym"
>     EXTENT -98.54 29.26 -96.35 27.15
>     UNITS MILES
>     SHAPEPATH "c:\ms\data\"
>         WEB
>         IMAGEPATH "C:\ms4w\tmp\ms_tmp"
>         IMAGEURL "http://localhost/ms_tmp/"
>     END
> END
>
>
>
> and here is a part of the code
>
>
> dl('php_mapscript_44.dll');
>
> $test = $HTTP_SESSION_VARS["test"];
>  //$map_path="C:\ms4w\tmp\ms_tmp\";
>  //   $map_file="Newcounty.map";
>     //$map = ms_newMapObj($map_path.$map_file);
> $map = ms_newMapObj("C:\ms4w\tmp\ms_tmp\Newcounty.map");
>
>       // $map_path="/home/census/WWW/ms/map_files/";
>    // $map_file="Newcounty.map";
>     //$map = ms_newMapObj($map_path.$map_file);
>
>         $map->{name} = 'Test';
>     $map->{status} = MS_ON;
>
>     $map->{interlace} = MS_OFF;
>     $map->{transparent} = MS_OFF;
>
> ....
>
>
> $layer = ms_newLayerObj($map);
>         $layer->set(name,"Surface_Type");
>         $layer->set(type,MS_LAYER_LINE);
>         $layer->set(status,MS_ON);
>         $layer->set(data,"Surface_Type");
>         $layer->set(tolerance,10);
>         $layer->set(classitem,"SURFACETYP");
>         $layer->set(transparency, 90);
>         $layer->set(labelitem,"HWY");
>             $prm="SURFACETYP";
>
>             $pop_undr_1500 = ms_newClassObj($layer);
>             $pop_undr_1500->set(status, MS_ON);
>             $pop_undr_1500->set(name, "51");
>             $pop_undr_1500->setexpression('([SURFACETYP]==51)');
>                 // create style
>                 $style = ms_newStyleObj($pop_undr_1500);
>                 $style->color->setRGB(255, 185, 215);
>                 $style->outlinecolor->setRGB(0, 0, 0);
>
>
> Thanks alot in advance.
>
> thank you,
> shashi.

-- 
Pericles S. Nacionales

Conservation Biology Program
University of Minnesota
1530 Cleveland Ave. N., 115GrnH
St. Paul, MN 55108



More information about the mapserver-users mailing list