mapscript map loading error

Manfred Meier m.meier at SPIEKERMANN.DE
Tue Jul 25 06:38:13 EDT 2006


.....
 > I still don't know why
 > both mapserv and mapscript is ok with me using
 > /usr/local/apache2/htdocs/tmp, but not on the others.

Hello,

perhaps there is a simple solution. If I understand right the mapserver 
doku, then IMAGEURL is relative to the apache document root. So "/tmp/" 
is by the apache interpreted as the absolute path 
"/usr/local/apache2/htdocs/tmp/" (I assume that 
/usr/local/apache2/htdocs is the documentroot in your httpd.conf).

So this combination of IMAGEURL and IMAGEPATH works perfectly because 
that is a directory tree owned by the user, the apache is running on.

Manfred




cris ricana schrieb:
> Hi Manfred!
> 
> Sorry, I haven't replied sooner. I have been away from the office for
> a few days and had just got back to fix this problem.
> 
> I did what your new suggestions, with no success. But I returned to
> the tmp folder and your suggestion if it is indeed readable and
> writeable by apache and mapserver. I experimented on three locations
> for my tmp-folder: in /var/www/tmp; in /usr/local/tmp; and
> /usr/local/apache2/htdocs/tmp, making all three locations readable and
> writeable. Then I used these three locations successively in the
> IMAGEPATH line of the map file. I also made two versions of a html
> file, one has CGI forms using mapserv and the other one has PHP
> mapscripts extensions and tags.
> 
> Using the CGI html file, mapserv had successfully written images to
> all three locations, but could only read/show the images from the
> /usr/local/apache2/htdocs/tmp folder. Mapscript can read/write on
> /usr/local/apache2/htdocs/tmp, but not on the other two.
> 
> Therefore, it seems that the matter is all about permissions of the
> tmp-dir and the created images as well. To make these folders
> readable/writable, I used "chmod 777", a command I'm not comfortable
> using. Could there be safer way of doing these? I still don't know why
> both mapserv and mapscript is ok with me using
> /usr/local/apache2/htdocs/tmp, but not on the others. I had to admit
> I'm not really a linx expert, so I probably am embarrassing myself
> with these questions, so well... <smiles sheepishly>
> 
> Maricris
> 
> 
> 
> On 7/20/06, Manfred Meier <m.meier at spiekermann.de> wrote:
> 
>> Hello,
>>
>> some additional "ideas": (You know, I'm not a php man)
>>
>> - is in your php.ini display_errors set to "on", so that erors are
>> shown? And are the errors and warnings activated?
>>
>> - you have this echo's in yout script as debug output. Can you insert an
>> echo after each of these 3 lines too,
>>  >        $map = ms_newMapObj($map_path);
>>  >        $image=$map->draw();
>>  >        $image_url=$image->saveWebImage();
>> so that you ca see what the last executed statement is?
>>
>> Manfred
>>
>>
>> cris ricana schrieb:
>>
>> > Hi!
>> >
>> > Here's the answer to your questions:
>> >
>> >> - is your tmp-dir writeable for the webserver?
>> >
>> >
>> > Yes it is. I've tested my mapserver installation successfully using
>> > CGI forms (the itasca samples, in particular) instead of PHP
>> > /mapscript. These CGI webpages performs well and writes their images
>> > in a temp folder I made (/usr/local/apache2/htdocs/tmp/).
>> >
>> >
>> >> - if you look at the source-code for the html-page in your browser, 
>> does
>> >> it show the correct url in the image tag?
>> >
>> >
>> > The output in the browser (as well as the source code) is simply these
>> > text:
>> >
>> > "php_mapscript.so loaded. /usr/local/apache2/htdocs/recipe1/hello.map"
>> >
>> > Which are text echoed from the php code (see my php code below) from
>> > line 3 and 5. There are no lines for the image at all. Actually, I
>> > added these text to locate where the problem is in my php code.
>> > Otherwise, the output in the browser would be a blank page.
>> >
>> >
>> > Regards,
>> > Maricris
>> >
>> >
>> >
>> >
>> >
>> >
>> > On 7/20/06, Manfred Meier <m.meier at spiekermann.de> wrote:
>> >
>> >> Hello,
>> >>
>> >> - is your tmp-dir writeable for the webserver?
>> >> - if you look at the source-code for the html-page in your browser, 
>> does
>> >> it show the correct url in the image tag?
>> >>
>> >> Manfred
>> >>
>> >>
>> >> cris ricana schrieb:
>> >>
>> >> > 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