[Mapserver-users] mapserv doesn't work

Paul Spencer spencer at dmsolutions.ca
Mon Jun 23 19:27:48 PDT 2003


Is it possible that the webserver runs as a different user and so
doesn't have the same environment?  I would try switching to the user
that the webserver runs as and check that ldd mapserv can correctly
resolve the paths to the various libaries.

I know that in RedHat systems, the path to /usr/local/lib is not in
/etc/ld.so.conf and most of the supporting libraries install to
/usr/local, so you need to add /usr/local/lib to /etc/ld.so.conf and
re-run /sbin/ldconfig (as root).  Is it possible that you define the
library path in your .bashrc or .bash_profile using LD_LIBRARY_PATH?
This would explain the discrepancy I think.

Cheers,

Paul

Chen Fu wrote:

> Pericles:
>   Thank you! I really find the root of my failure. I
> check the log of apache, there is something wrong with
> libgd. Here is the content of error_log. I don't know
> why mapserver try to find libgd.so.2 when i run in cgi
> mode. But it work fine when it is used in command
> line. What's up?
> 
> .0.0.1] Premature end of script headers: mapserv
> [Fri Jun 20 10:19:36 2003] [error] [client 127.0.0.1]
> /var/www/cgi-bin/mapserv: error while loading shared
> libraries: libgd.so.2: cannot open shared object file:
> No such file or directory
> [Fri Jun 20 10:19:47 2003] [error] [client 127.0.0.1]
> attempt to invoke directory as script:
> /var/www/cgi-bin/
> [Fri Jun 20 10:19:53 2003] [error] [client 127.0.0.1]
> Premature end of script headers: mapserv
> [Fri Jun 20 10:19:53 2003] [error] [client 127.0.0.1]
> /var/www/cgi-bin/mapserv: error while loading shared
> libraries: libgd.so.2: cannot open shared object file:
> No such file or directory
> [Fri Jun 20 15:21:00 2003] [error] [client 127.0.0.1]
> Premature end of script headers: mapserv
> [Fri Jun 20 15:21:00 2003] [error] [client 127.0.0.1]
> /var/www/cgi-bin/mapserv: error while loading shared
> libraries: libgd.so.2: cannot open shared object file:
> No such file or directory
> [Fri Jun 20 22:00:45 2003] [error] [client 127.0.0.1]
> Premature end of script headers: mapserv
> [Fri Jun 20 22:00:45 2003] [error] [client 127.0.0.1]
> /var/www/cgi-bin/mapserv: error while loading shared
> libraries: libgd.so.2: cannot open shared object file:
> No such file or directory
> [Fri Jun 20 22:00:48 2003] [error] [client 127.0.0.1]
> Premature end of script headers: mapserv
> [Fri Jun 20 22:00:48 2003] [error] [client 127.0.0.1]
> /var/www/cgi-bin/mapserv: error while loading shared
> libraries: libgd.so.2: cannot open shared object file:
> No such file or directory
> [Fri Jun 20 22:00:51 2003] [error] [client 127.0.0.1]
> Premature end of script headers: mapserv
> [Fri Jun 20 22:00:51 2003] [error] [client 127.0.0.1]
> /var/www/cgi-bin/mapserv: error while loading shared
> libraries: libgd.so.2: cannot open shared object file:
> No such file or directory
> [Fri Jun 20 22:19:31 2003] [error] [client 127.0.0.1]
> Premature end of script headers: mapserv
> [Fri Jun 20 22:19:31 2003] [error] [client 127.0.0.1]
> /var/www/cgi-bin/mapserv: error while loading shared
> libraries: libgd.so.2: cannot open shared object file:
> No such file or directory
> [Fri Jun 20 22:20:00 2003] [error] [client 127.0.0.1]
> Premature end of script headers: mapserv
> [Fri Jun 20 22:20:00 2003] [error] [client 127.0.0.1]
> /var/www/cgi-bin/mapserv: error while loading shared
> libraries: libgd.so.2: cannot open shared object file:
> No such file or directory
> [Sat Jun 21 11:14:52 2003] [error] [client 127.0.0.1]
> Premature end of script headers: mapserv
> [Sat Jun 21 11:14:52 2003] [error] [client 127.0.0.1]
> /var/www/cgi-bin/mapserv: error while loading shared
> libraries: libgd.so.2: cannot open shared object file:
> No such file or directory
> [Sat Jun 21 11:17:01 2003] [error] [client 127.0.0.1]
> Premature end of script headers: mapserv
> [Sat Jun 21 11:17:01 2003] [error] [client 127.0.0.1]
> /var/www/cgi-bin/mapserv: error while loading shared
> libraries: libgd.so.2: cannot open shared object file:
> No such file or directory
> [Sat Jun 21 11:17:25 2003] [error] [client 127.0.0.1]
> script not found or unable to stat:
> /var/www/cgi-bin/mapser
> [Sat Jun 21 11:23:47 2003] [error] [client 127.0.0.1]
> script not found or unable to stat:
> /var/www/cgi-bin/mapserv map=
> [Sat Jun 21 11:23:57 2003] [error] [client 127.0.0.1]
> Premature end of script headers: mapserv
> [Sat Jun 21 11:23:57 2003] [error] [client 127.0.0.1]
> /var/www/cgi-bin/mapserv: error while loading shared
> libraries: libgd.so.2: cannot open shared object file:
> No such file or directory
> [Sat Jun 21 11:31:01 2003] [error] [client 127.0.0.1]
> Premature end of script headers: mapserv
> [Sat Jun 21 11:31:01 2003] [error] [client 127.0.0.1]
> /var/www/cgi-bin/mapserv: error while loading shared
> libraries: libgd.so.2: cannot open shared object file:
> No such file or directory
> [Sat Jun 21 11:35:35 2003] [error] [client 127.0.0.1]
> script not found or unable to stat:
> /var/www/cgi-bin/mapserv
> [Sat Jun 21 11:37:41 2003] [error] [client 127.0.0.1]
> Premature end of script headers: mapserv
> [Sat Jun 21 11:37:41 2003] [error] [client 127.0.0.1]
> /var/www/cgi-bin/mapserv: error while loading shared
> libraries: libgd.so.2: cannot open shared object file:
> No such file or directory
> [Sun Jun 22 04:02:03 2003] [notice] SIGHUP received. 
> Attempting to restart
> 
>  --- "Pericles S. Nacionales" <nacional at cbs.umn.edu>
> µÄÕýÎÄ£º> Chen,
> 
>>Have you checked your web server's error log to see
>>if there's any
>>relevant messages related to mapserv?  I can compile
>>MapServer for you
>>but I don't know if that will solve your problems.
>>
>>-Perry
>>
>>On Sun, 2003-06-22 at 01:11, Chen Fu wrote:
>>
>>>Hi!
>>>Will it be possible that somebody share the
>>
>>compiled
>>
>>>mapserv with me? If the compile use static lib, it
>>
>>can
>>
>>>also used in my linux box, right?
>>>Thanks
>>>
>>> --- Vincent Schut <schut at sarvision.com>
>>
>>的正文:>
>>
>>>Chen,
>>>
>>>>it is very strange that from the commandline
>>
>>mapserv
>>
>>>>works, but not from your 
>>>>browser. Your server should simply start mapserv
>>
>>and
>>
>>>>stream the output to 
>>>>your browser... Are you sure that you have the
>>
>>right
>>
>>>>mapserv executable in 
>>>>the right cgi-bin directory (sorry for the
>>
>>obvious
>>
>>>>question, don't mean to 
>>>>offend... :-)) ? But you won't be the first one
>>
>>to
>>
>>>>copy your new mapserv in 
>>>>an old cgi-bin dir that is not used anymore...
>>
>>(did
>>
>>>>it once myself).
>>>>Try using not only localhost/cgi-bin/mapserv,
>>
>>but
>>
>>>>add the values you added as 
>>>>querystring at the commandline
>>>>(http:/localhost/cgi-bin/mapserv 
>>>>map=/../../map.map&mode=map
>>>>What do you get then?
>>>>BTW you don't need php to use mapserver, I was
>>
>>wrong
>>
>>>>in assuming that you used 
>>>>php... Mapserver as cgi is just as powerfull as
>>
>>the
>>
>>>>php/mapscript version, I 
>>>>think. At least powerfull enough for this
>>
>>debugging.
>>
>>>>Good luck!
>>>>Vincent.
>>>>On Friday 20 June 2003 16:05, Chen Fu wrote:
>>>>
>>>>>Vincent:
>>>>>Thank you for your reponse!
>>>>>My mapserv works in "Query...", it print out a
>>
>>lot
>>
>>>>of
>>>>
>>>>>ascii as you said. I think it is the data of
>>
>>the
>>
>>>>>generated image.
>>>>>Then what should i do? Should i config
>>
>>something
>>
>>>>like
>>>>
>>>>>php? My project doesn't use php up to now. But
>>
>>it
>>
>>>>will
>>>>
>>>>>be accepted if mapserv has to work with php
>>
>>lib.
>>
>>>>> --- Vincent Schut <schut at sarvision.com>
>>
>>的正文:>
>>
>>>>>Chen,
>>>>>
>>>>>
>>>>>>The error you get is a very generic error
>>>>
>>>>generated
>>>>
>>>>>>by php I think. To find
>>>>>>out more about what goes wrong, you should
>>
>>at
>>
>>>>least
>>>>
>>>>>>run mapserver from the
>>>>>>command prompt, and prefereable thourgh a
>>>>
>>>>debugger.
>>>>
>>>>>>To run it from the command prompt, type (in
>>
>>the
>>
>>>>dir
>>>>
>>>>>>where the mapserv
>>>>>>executable is):
>>>>>>./mapserv
>>>>>
>>>>>
> "QUERY_STRING=map=/var/mapserver/mapfiles/province2.map&mode=map"
> 
>>>>>>(of course fill in your own mapfile/path and
>>>>>>eventual other parameters. I
>>>>>>think you need to specify at least map and
>>
>>mode.
>>
>>>>>>This example prints the
>>>>>>image data to stdout, so you will see your
>>
>>png
>>
>>>>or
>>>>
>>>>>>gif or whatever scrolling
>>>>>>as ascii on you terminal :-)
>>>>>>But probably you will see an error message
>>>>
>>>>instead
>>>>
>>>>>>of image data.
>>>>>>
>>>>>>If it is still very generic, like a
>>
>>segmentation
>>
>>>>>>fault, you should use a
>>>>>>debugger.
>>>>>>To run mapserv from the debugger, do the
>>>>
>>>>following:
>>>>
>>>>>>make sure you have gdb (the gnu debugger)
>>
>>and
>>
>>>>type:
>>>>
>>>>>>gdb mapserv
>>>>>>run
>>>>>
>>>>>
> "QUERY_STRING=map=/var/mapserver/mapfiles/province2.map&mode=map"
> 
>>>>>>and after the error, type:
>>>>>>backtrace
>>>>>>This will show you in which function mapserv
>>
>>(or
>>
>>>>a
>>>>
>>>>>>library) segfaulted.
>>>>>>Maybe than you will know what to do.
>>
>>Otherwise,
>>
>>>>send
>>>>
>>>>>>your experiences and the
>>>>>>mapserv and  debugger output to this list
>>
>>and
>>
>>>>I'm
>>>>
>>>>>>sure you will get more
>>>>>>help.
>>>>>>
>>>>>>Cheers,
>>>>>>Vincent Schut.
>>>>>>
>>>>>>On Friday 20 June 2003 09:12, Chen Fu wrote:
>>>>>>
>>>>>>>Till!?
>>>>>>>   My linux box is base on redhat8. the
>>
>>make
>>
>>>>>>generate
>>>>>>
>>>>>>
>>>>>>>some warning but no error. the mapserv is
>>>>
>>>>375445
>>>>
>>>>>>>bytes. I think it is much smaller than the
>>
>>one
>>
>>>>i
>>>>
>>>>>>used
>>>>>>
>>>>>>
>>>>>>>in win2k. But i config it with gd lib
>>
>>only.
>>
>>>>>>>   if i type "./mapserv" it will show
>>>>>>>"
>>>>>>>This script can only be used to decode
>>
>>form
>>
>>>>>>results
>>>>>>
>>>>>>
>>>>>>>and
>>>>>>>should be initiated as a CGI process via a
>>>>
>>>>httpd
>>>>
>>>>>>>server.
>>>>>>>"
>>>>>>>Is it mean the file is a validate
>>
>>executable?
>>
>>>>>>shp2img
>>>>>>
>>>>>>
>>>>>>>generated in the same procession work very
>>>>
>>>>nice.
>>>>
>>>>>>>I search the archive for that message
>>
>>before i
>>
>>>>>>post it
>>>>>>
>>>>>>
>>>>>>>here. But most i found is related to php
>>
>>or
>>
>>>>some
>>>>
>>>>>>other
>>>>>>
>>>>>>
>>>>>>>thing. Because i am a newbie in compiling
>>
> === message truncated === 
> 
> =====
> Remote Scensing Satellite Ground Station
> Chinese Academy of Science
> 
> _________________________________________________________
> Do You Yahoo!? 
> ÍøÁµµÄÚ¹ÊÍ£ºÕæÇ黹ÊÇ·Å×Ý£¿
> http://cn.rd.yahoo.com/mail_cn/tag/?http://cn.surveys.yahoo.com/netlove
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> 

-- 
Paul Spencer
Applications and Software Development
DM Solutions Group Inc.
http://www.dmsolutions.ca





More information about the MapServer-users mailing list