Search code examples
perlxamppmod-perlhttpexception

xampp 1.8.1 perl not working and throwing error 500


I am using xampp 1.8.1 on windows 7 and want to use it for perl, but when i execute even the most easy hello world perl script it gives me an error 500. Does anybody know what i am doing wrong? this is my 'hello world script:

 #!/usr/bin/perl
print "Hello World.\n";

Thanks in advance,


Solution

  • Change the shebang line to actually point to your Perl path, for example:

    #!c:/Strawberry/perl/bin/perl.exe
    

    You can quote it if necessary:

    #!"c:/Program Files/Perl/perl.exe"
    

    Note that in Perl you can always use forward slashes for directories even on Windows (and this is preferred because it avoids messy escaping issues).

    On Windows, the path in the shebang line is not normally used for execution. Thus the convention is often to use #!/usr/bin/perl for compatibility with Linux. However, Apache actually does use this path, so it needs to be set accordingly.