Here is the sample script I am trying to execute: #!/usr/bin/perl # hello.pl -- my first perl script! print "Content-type: text/html\n\n";
This is what I get running it from shell: [eric@Mithrilhall cgi-bin]$ ls -lh total 48k -rw-r--r-- 1 apache apache 268 Oct 17 15:09 printenv -rwxr--r-- 1 root root 788 Mar 28 22:16 script.cgi* -rw-r--r-- 1 apache apache 757 Oct 17 15:09 test-cgi -rwxr-xr-x 1 root root 216 Mar 28 14:34 test.cgi* -rwxr-xr-x 1 eric eric 20k Mar 27 23:48 wwwboard.pl* -rwxr-xr-x 1 root root 102 Mar 31 02:08 x2.cgi* -rwxr-xr-x 1 root root 92 Mar 29 00:19 x.cgi* [eric@Mithrilhall cgi-bin]$ perl x.cgi Content-type: text/html [eric@Mithrilhall cgi-bin]$ When trying to run it from the browser this is how I call it: http://mithrilhall.redirectme.net/cgi-bin/x.cgi This is the result in the browser: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. ------------------------------------------------------------------------ -------- Apache-AdvancedExtranetServer/1.3.22 Server at Mithrilhall.LinuxServer Port 80 This is the error I got in the error log: [Mon Apr 1 23:39:40 2002] [error] (2)No such file or directory: exec of /var/www/cgi-bin/x.cgi failed [Mon Apr 1 23:39:40 2002] [error] [client 192.168.1.1] Premature end of script headers: /var/www/cgi-bin/x.cgi -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Gerald Waugh Sent: March 31, 2002 4:54 AM To: [EMAIL PROTECTED] Subject: Re: [newbie] CGI/Perl question On Sunday 31 March 2002 02:02 am, Mithrilhall2000 wrote: > Here ya go: > > [eric@Mithrilhall cgi-bin]$ ls -lh > total 52k > -rwxr-xr-x 1 root root 359 Mar 28 13:12 hello.cgi* > -rwxr-xr-x 1 root root 359 Mar 28 13:13 hello.pl* > -rw-r--r-- 1 apache apache 268 Oct 17 15:09 printenv > -rwxr--r-- 1 root root 788 Mar 28 22:16 script.cgi* > -rw-r--r-- 1 apache apache 757 Oct 17 15:09 test-cgi > -rwxr-xr-x 1 root root 216 Mar 28 14:34 test.cgi* > -rwxr-xr-x 1 eric eric 20k Mar 27 23:48 wwwboard.pl* > -rwxr-xr-x 1 root root 92 Mar 29 00:19 x.cgi* > [eric@Mithrilhall cgi-bin]$ > looks like +x is turned on. You have to watch ownership to get the cgi Also what does /var/log/httpd/error_log read, after you run the script. Make sure that #!/usr/bin/perl Is the very first line in the script (must be at the top of the page) The '*' in this line must be the very first character in the file -- Gerald Waugh : Registered Linux user # 255245 http://www.frontstreetnetworks.com New Haven, CT, United States of America 7:10am up 9 days, 15:35, 2 users, load average: 1.05, 1.02, 1.07 _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com