XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).
Moderator: General Moderators
chrys
Forum Contributor
Posts: 118 Joined: Tue Oct 04, 2005 9:41 am
Location: West Roxbury, MA (Boston)
Post
by chrys » Sun Mar 05, 2006 3:29 pm
Searched around can't find solution.. but I have a simple script:
Code: Select all
#!/usr/local/bin/perl
use CGI;
my $query= new CGI;
print $query->header;
print "hello people in my head\n";
When I view it via web browser I get a Internal Server Error 500.
When I run it via shell:
Code: Select all
> perl perl.cgi
Content-Type: text/html; charset=ISO-8859-1
hello people in my head
Any ideas?
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Sun Mar 05, 2006 3:43 pm
The internal server error (500) usually means that apache couldn't execute the file.
Did you set the "execute" bit for it? "CHMOD 0777" would guarantee that
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Sun Mar 05, 2006 3:45 pm
Oh... and by the way. By typing "perl" in the command line you're by-passing the shebang line.
Type:
./scriptname.cgi
That will give you an error in the command line if the shebang is wrong or it's not executable
chrys
Forum Contributor
Posts: 118 Joined: Tue Oct 04, 2005 9:41 am
Location: West Roxbury, MA (Boston)
Post
by chrys » Sun Mar 05, 2006 3:51 pm
Thanks man. Wow I just pulled an amateur move lol, I didn't make it executable!
I haven't done perl in so long, I'm mainly a PHP man now. But a client requested this as a perl script, so it's time to dip my feet again
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Sun Mar 05, 2006 4:03 pm
chrys wrote: Thanks man. Wow I just pulled an amateur move lol, I didn't make it executable!
I haven't done perl in so long, I'm mainly a PHP man now. But a client requested this as a perl script, so it's time to dip my feet again
And you love it!
Perl is great. I still dabble in it from time to time because I just love its funky regex magic
Great for CLI scripts too, although I can do cool things with PHP and Ncurses now.