PDA

View Full Version : Active Perl CGI on Apache, Windows returning 500


anjanesh
07-27-2006, 04:29 PM
Hi

Im into PHP, Apache, MySQL and have installed it on my Widnows XP machine.

Now I got a perl script that needs to be run using the browser.

I installed Active Perl and its located at C:\Perl

I have this in my httpd.conf file :

ScriptAlias /cgi-bin/ "C:/htdocs/cgi/"
<Directory "C:/htdocs/cgi">
AllowOverride All
Options All
Order allow,deny
Allow from all
</Directory>
AddHandler cgi-script .cgi
AddHandler cgi-script .pl


In my perl.cgi file in C:\htdocs\cgi I have

#! C:/Perl/bin/perl.exe
print "Working";


http://localhost/cgi/perl.cgi is returning Internal Server Error

Any idea whats wrong ?

Thanks

FishMonger
07-27-2006, 04:45 PM
You need to print the html header.

#! C:/Perl/bin/perl.exe

print "Content-type: text/html\n\n";
print "Working";

anjanesh
07-27-2006, 04:53 PM
lol. I Cannot belive it was so simple.
PHP, ASP, JSP seem to take it by default. Didnt know Perl required us to force this line ! Thanks !

EDIT : Im using a Windows PC and I got the add the line :

#! C:/Perl/bin/perl.exe

but to upload to my Linux Server I got to use
#! /usr/local/perl

Any easy way to bypass making the changes each time I update the file on my local PC and upload to the server ?