fedora apache cgi-perl

Phil Meyer pmeyer at themeyerfarm.com
Tue Jan 16 17:18:41 UTC 2007


Thibaut wrote:
> On Jan 15, 2007, at 10:43 PM, Phil Meyer wrote:
>
>> Thibaut wrote:
>>> Hi,
>>>
>>> I try to run a perl script in my webserver. Therefore I put a script 
>>> in the /var/www/cgi-bin/ directory. I have put the 777 permission on 
>>> it. Here is the script :
>>>
>>> #!/usr/bin/perl -w
>>> print "Content-type: text/html\n\n";
>>> print "<html><head><title>Hello World!! </title></head>\n";
>>> print "<body><h1>Hello world</h1></body></html>\n";
>>>
>>
>> The 'better way, from the CGI man page:
>>
>> #!/usr/bin/perl -w
>>
>> use CGI;
>> use strict;
>>
>> my $q = new CGI;
>>
>> print $q->header,                    # create the HTTP header
>>        $q->start_html('hello world'), # start the HTML
>>        $q->h1('hello world'),         # level 1 header
>>        $q->end_html;                  # end the HTML
>>
>>
>
>
> Thank you for your answer. I change the code to the one you gave me.
>
> When i do "perl hello.pl" it prints the right html without any error.
>
> When i try to run it with apache, here is the error in the browser : 
> "Internal Server Error"
> and in the log : "[Tue Jan 16 09:26:01 2007] [error] [client my ip 
> adress] Premature end of script headers: hello.pl"
>
> Here is the vhost.conf configuration for this host :
>
>         ScriptAlias /cgi-bin/ 
> /home/default/duck-art.com/user/htdocs/cgi-bin/
>         <Directory "/home/default/duck-art.com/user/htdocs/cgi-bin">
>             AllowOverride None
>             Options None
>             Order allow,deny
>             Allow from all
>         </Directory>
>
>
>
>
>
>
>
>
>
>
> --fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

Try quoting the directory in the ScriptAlias definition.
It really does look like the script is not executing.

Possibilities other than ScriptAlias definition:

permissions:
    all directories up to and including the cgi-bin directory must be 
readable by the web service user -- usually apache
    The executable files in cgi-bin should be 755

Other configuration possibilities:

if:
    AddHandler cgi-script .cgi
is used, it changes the behavior a bit.  perl scripts then should end 
with .cgi

if:
    LoadModule cgi_module modules/mod_cgi.so
is NOT used, then it will change cgi behavior

There may be others.

Good luck!




More information about the fedora-list mailing list