mapscript map loading error

cris ricana crisricana at GMAIL.COM
Thu Jul 20 04:05:32 EDT 2006


Hello!

I'd like some help in using PHP/Mapscript. I have a freshly installed
Mapserver machine and is testing some simple php webpages to see if
everything is working, especially PHP/Mapscript:

<?php
        dl ("php_mapscript.so");
        echo("php_mapscript.so loaded.\n");   //to see if the library will
sucessfully load.
        $map_path="/usr/local/apache2/htdocs/recipe1/hello.map";
        echo($map_path);                             // absolute path
to the map file
        $map = ms_newMapObj($map_path);
        $image=$map->draw();
        $image_url=$image->saveWebImage();
?>
<HTML>
 <HEAD>
 <TITLE>Mapserver "hello world"</TITLE>
 </HEAD>
 <BODY>
<img SRC="<?php echo $image_url; ?>">
 <p>This is the simplest example I could come up with.</p>
...
</BODY>
</html>

I'm using the following map file. It should produce an image with just
a line of text in it:

MAP
        NAME HELLO
        STATUS ON
        EXTENT 0 0 4000 3000
        SIZE 400 300
        IMAGECOLOR 200 255 255
        WEB
                IMAGEPATH "/usr/local/apache2/htdocs/tmp/"
                IMAGEURL "/tmp/"
        END

        LAYER
                NAME "credits"
                STATUS DEFAULT
                TRANSFORM FALSE
                TYPE ANNOTATION
                FEATURE
                        POINTS
                                200 150
                        END
                        TEXT 'Hello world.  Mapserver rocks.'
                END
                CLASS
                        LABEL
                                TYPE BITMAP
                                COLOR 0 0 0
                        END
                END
        END

END

The output I'm getting from the browsers is just the following:

                 php_mapscript.so loaded.
/usr/local/apache2/htdocs/recipe1/hello.map

So it seems that everything is working, but only until it encounters
the "$map = ms_newMapObj($map_path);" line. I've checked the tmp
folder I've made to store the images and no images are made (no
surprise there). Would somebody know what the problem might be and
what could be the solution for this? I really, really need to know.

Thanks,
Maricris



More information about the mapserver-users mailing list