[mapserver-users] Couldn't run perl mapscript under Apache

krung krung at cad.go.th
Sun Nov 10 10:05:09 EST 2002


Puneet

As I told you last message, error_log showed no cause except "[Sun Nov 10 22.04.55] [error] [client 127.0.0.1] Premature end of script headers: /map/testmap.pl".

I didn't know if I checked for error line correctly. I script it:

use mapscript;
use CGI qw/:standard/;

print header();
$map = new mapObj("mapfile.map") or print "couldn't open map file\n";
unless ($map) { exit;}
print 'OK';exit;    <-- this line for checking openning map file and be removed if it prints.
$img = $map->draw() or print "images couldn't be drawn\n";
unless ($img) { exit;}
....
....

In line "print 'OK';exit;", I used it to check if openning mapfile had error. It printed 'OK', so it could open mapfile. Then I removed it out and re-run the script. It showed "Internal Server Error" to my browser. Error message I got from error_log in /etc/httpd/logs/error_log and /var/log/httpd/error_log was that I showed you in the beginning of this message. I didn't know what and how to solve this trouble.

Thank you
Krung.




---------- Original Message ----------------------------------
From: Puneet Kishor <pkishor at geoanalytics.com>
Date:  Sat, 9 Nov 2002 19:36:00 -0600

>
>On Saturday, November 9, 2002, at 11:09  AM, krung wrote:
>
>> Hi Lowell, Puneet
>>
>> I tried as you told me. If I ran with command line, mapserver.log was 
>> created whem error occured. But when run on Apache, mapserver's never 
>> created as error occured. (access right with this directory'd set to 
>> 777 already) So I checked it at error_log of httpd log file, but it's 
>> non-sense to me. It showed only "Premature of script headers: 
>> /usr/mapserver/testmap.pl".
>>
>> And I tried to change script logic flow as you, Puneet, told me. It's 
>> the same error as before (Internal Server Error).
>
>Krung,
>
>You really have to tell us what the error is. The "Internal Server 
>Error" is the end result. Usually, that end result is the result of one 
>or more errors happening in tandem. Do the following (assuming your 
>apache log is under /var/log/httpd/)... type "tail -f 
>/var/log/httpd/error_log". This will output the last few lines of the 
>log file on your stdout, and keep the handle open. Now run your 
>mapserver script via the web server. You will see the tail output 
>change. Copy the lines that were outputted as a result of your last 
>attempt to load the mapserver page. Mail that to the list. Then we will 
>know better what is going on.
>
>Another question. In your message you say
>
>>>> $img = $map->draw();  # <---- error took place here
>
>
>How do you know that the error took place there? Usually the script 
>breaks because of an error before the break.
>
>Again, send us all the error messages. Only then can we help.
>
>I am assuming that perl runs fine as cgi on your computer otherwise.
>
>pk/
>
>
>
>
>>
>> Do I have to specially configure when I create mapserver program? Any 
>> comments, help, advice would be graceful.
>>
>> Thank you
>> Krung
>>
>>
>> ---------- Original Message ----------------------------------
>> From: "Lowell Filak"<lfilak at medinaco.org>
>> Date:  Thu, 07 Nov 2002 08:24:06 -0500
>>
>>> You can try adding the line noted below and see if a file 
>>> mapserver.log exists in the current directory and if it reports an 
>>> error.
>>> If the mapserver.log file isn't created then try changing the path of 
>>> the log file to somewhere writeable by the apache process.
>>> HTH
>>> Lowell F.
>>>
>>> The following message was sent by "Krung Saengpole" <krung at cad.go.th> 
>>> on Thu,  7 Nov 2002 18:45:20 +0700.
>>>
>>>> Hello all,
>>>>
>>>> I had trouble getting perl mapscript run on Apache 1.3.26 under RH 
>>>> 7.2. Mapscript compiled from mapserver 3.6.3.
>>>>
>>>> My script is:
>>>>
>>>> #!/usr/bin/perl
>>>> use mapscript;
>>>> use CGI qw/:standard/;
>>>
>>> $ENV{MS_ERRORFILE} = "mapserver.log"; <--Try adding this line.
>>>
>>>>
>>>> print header();
>>>> print start_html();
>>>> $map = new mapObj('mapfile.map');
>>>> $img = $map->draw();  # <---- error took place here
>>>> $img->saveImage('file.png', $mapscript::MS_PNG,1,1,0);
>>>> ....
>>>> ....
>>>>
>>>> What I did wrong with this script or anything else? But I could run 
>>>> this script at command line. I'm very new to Linux. I tried to write 
>>>> a script that open database and run under Apache, it had no problem. 
>>>> So, I thought it should not be wrong with Apache configuration.
>>>>
>>>> Thank you in advance.
>>>> Krung.
>>>
>>>
>>>
>
>
>




More information about the mapserver-users mailing list