Cgi scripts not working in xampp mac

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Cgi scripts not working in xampp mac

Postby rj12a » 20. November 2009 17:32

my cgi scripts are not working in xampp mac, not even the test-cgi

they are formatted for unix...
Server error!

The server encountered an internal error and was unable to complete your request.

Error message:
Premature end of script headers: test-cgi

If you think this is a server error, please contact the webmaster.

Error 500

localhost
Fri Nov 20 10:28:47 2009
Apache/2.2.12 (Unix) DAV/2 mod_ssl/2.2.12 OpenSSL/0.9.8k PHP/5.3.0 mod_perl/2.0.4 Perl/v5.10.0


any help would be appreciated
rj12a
 
Posts: 8
Joined: 16. October 2009 21:06
Location: Wausau WI

Re: Cgi scripts not working in xampp mac

Postby Wiedmann » 20. November 2009 17:38

Maybe ask the webmaster (see the error message)? ;-)

Something in the Apache "error.log"?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Cgi scripts not working in xampp mac

Postby rj12a » 30. November 2009 09:15

-_-

i am the webmaster... its being run on xampp....

heres what i got
Code: Select all
[Mon Nov 30 02:09:50 2009] [error] [client ::1] (13)Permission denied: exec of '/Applications/XAMPP/xamppfiles/cgi-bin/test-cgi' failed
[Mon Nov 30 02:09:50 2009] [error] [client ::1] Premature end of script headers: test-cgi
[Mon Nov 30 02:11:21 2009] [error] Software caused connection abort at /Applications/XAMPP/xamppfiles/lib/perl5/site_perl/5.10.0//HTML/Perlinfo/Base.pm line 106.\n
[Mon Nov 30 02:11:21 2009] [error] [client ::1] Handler for type-map returned invalid result code 53, referer: http://localhost/xampp/navi.php

That was the test-cgi that came with xampp download
also on another file
Code: Select all
[Mon Nov 30 02:14:33 2009] [error] [client ::1] (13)Permission denied: exec of '/Applications/XAMPP/xamppfiles/htdocs/perl/cgi-bin/welcome.cgi' failed
[Mon Nov 30 02:14:33 2009] [error] [client ::1] Premature end of script headers: welcome.cgi
[Mon Nov 30 02:14:34 2009] [error] [client ::1] (13)Permission denied: exec of '/Applications/XAMPP/xamppfiles/htdocs/perl/cgi-bin/welcome.cgi' failed
[Mon Nov 30 02:14:34 2009] [error] [client ::1] Premature end of script headers: welcome.cgi


so yeah, not sure whats going on here

here maybe this will help its the code from the welcome.cgi
Code: Select all
#!/Applications/XAMPP/xamppfiles/bin/perl
print "Content-type: text/html\n\n";
use CGI qw(:standard);

use strict;

print "<HTML>\n";
print "<head>\n";
print "<title>Welcome to Perl</title>\n";

print "<style type='text/css'>\n";
print "body {background-color:lightgreen}\n";
print "</style>\n";

print "</head>";
print "<BODY>\n";

print "<br/><br/><br/><br/>\n";
print "<h2 align='center'>Northcentral Technical College</h2>\n";
print "<h3 align='center'>Welcome to Perl, Course #107-233</h2>\n";
print "<h5 align='center'>Student: Matt M</h5>\n";

print "<a href='/../../index.html'>Back</a>";

print "</BODY>\n";
print "</HTML>\n";
rj12a
 
Posts: 8
Joined: 16. October 2009 21:06
Location: Wausau WI

Re: Cgi scripts not working in xampp mac

Postby rj12a » 30. November 2009 20:18

Well, heres a fun fact, when i change the filetype from .cgi to .pl

Hey! it works!

... anyways to complete that functionality, add recognition of .cgi to the files? Otherwise i guess i will be going with .pl from now on
rj12a
 
Posts: 8
Joined: 16. October 2009 21:06
Location: Wausau WI

Re: Cgi scripts not working in xampp mac

Postby MegaChriz » 02. December 2009 09:05

rj12a wrote:add recognition of .cgi to the files?

I'm not sure, but maybe it could be done with a AddType line in httpd.conf.
Example:
Code: Select all
AddType application/x-httpd-php .php .php3 .php4


Hm, in my XAMPP-installation (v1.0.1) I also see this line:
Code: Select all
AddHandler cgi-script .cgi .pl

I have no experience with Perl or cgi-scripts, so I'm not sure what will work.
MegaChriz
 
Posts: 158
Joined: 16. February 2009 15:04
Location: Amersfoort, The Netherlands
Operating System: Mac OS X

Re: Cgi scripts not working in xampp mac

Postby rj12a » 04. December 2009 21:12

Hmm well i think the file we would need to do that is the httpd-xampp.conf
Code: Select all
<IfDefine PHP>
LoadModule php5_module        modules/libphp5.so
</IfDefine>
LoadModule perl_module        modules/mod_perl.so

Alias /phpmyadmin "/Applications/XAMPP/xamppfiles/phpmyadmin"

<Directory "/Applications/XAMPP/xamppfiles/phpmyadmin">
    AllowOverride AuthConfig Limit
</Directory>

#
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
    Order deny,allow
    Deny from all
    Allow from ::1 127.0.0.0/8 \
               fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \
               fe80::/10 169.254.0.0/16

    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>

AddType application/x-httpd-php .php .php3 .php4

XBitHack on

<IfModule perl_module>
    PerlPostConfigRequire "/Applications/XAMPP/xamppfiles/etc/extra/startup.pl"
   
    # mod_perl settings
    <IfModule mime_module>
        AddType text/html .pl
    </IfModule>
   
    <FilesMatch "\.pl$">
        SetHandler perl-script
        PerlResponseHandler ModPerl::RegistryPrefork
        PerlOptions +ParseHeaders
    </FilesMatch>
   
    <Directory "/xampp/cgi-bin">
        <FilesMatch "\.pl$">
            SetHandler cgi-script
        </FilesMatch>
    </Directory>
   
    # ASP settings
    <IfModule mime_module>
        AddType text/html .asp
    </IfModule>
   
    <FilesMatch "\.asp$">
        SetHandler  perl-script
        PerlResponseHandler Apache::ASP
        PerlSetVar  Global .
        PerlSetVar  StateDir "/Applications/XAMPP/xamppfiles/temp"
    </FilesMatch>
   
    <Directory "/xampp/cgi-bin">
        <FilesMatch "\.asp$">
            SetHandler cgi-script
        </FilesMatch>
    </Directory>
</IfModule>

# demo for mod_perl responsehandler
#PerlModule Apache::CurrentTime
#<Location /time>
#      SetHandler modperl
#      PerlResponseHandler Apache::CurrentTime
#</Location>

# AcceptMutex sysvsem is default but on some systems we need this
# thanks to jeff ort for this hint
#AcceptMutex flock
#LockFile /opt/lampp/logs/accept.lock

# this makes mod_dbd happy - oswald, 02aug06
#DBDriver sqlite3


That seems like the right one to me...
rj12a
 
Posts: 8
Joined: 16. October 2009 21:06
Location: Wausau WI


Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: No registered users and 3 guests