Problem with CGI


#1

I wrote my first CGI “program”(Hello World), actually copied it :wink: and put it in the cgi-bin directory under my domain; have been trying unsuccessfully to make it work. I’ve run it outside the web server (from the shell) and it seems to be working fine. Here is the log from the shell:
[voss]$ cd cgi-bin
[voss]$ ls
hello.pl
[voss]$ perl -w hello.pl
Content-type: text/html

Hello World!

Hello World!

Then, I’ve made the program readable and executable (chmod a+rx ./hello.pl)
I’ve tried to run it from http://mydomain/cgi-bin/hello.pl and have encountered a problem:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@mydomain.com 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.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I’ve checked the server error log and it shows:

[Wed Mar 21 18:07:16 2007] [error] [client my IP] failed to open log file
[Wed Mar 21 18:07:16 2007] [error] [client my IP] fopen: Permission denied
[Wed Mar 21 18:07:16 2007] [error] [client my IP] Premature end of script headers: hello.pl
[Wed Mar 21 18:07:16 2007] [error] [client my IP] File does not exist: /home/username/mydomain.com/internal_error.html
[Wed Mar 21 18:07:17 2007] [error] [client my IP] File does not exist: /home/username/mydomain.com/favicon.ico
[Wed Mar 21 18:07:17 2007] [error] [client my IP] File does not exist: /home/username/mydomain.com/missing.html

I have no clue what should be done next. Could anyone help me?


#2

The way you’re referencing the file, you would need your cgi-bin folder to be in your domain directory. I’m guessing that your hosted directory is not called voss as it’s traditionally “domain.tld” here at DH. Just move your cgi-bin into your domain directory and then you’ll be able to at least see the file with the URL you’ve given. Hopefully the .pl extension will convince apache to actually execute it with perl.

Wholly - Use promo code WhollyMindless for full 97$ credit. Let me know if you want something else!


#3

The cgi-bin folder is located in my directory, under my domain /home/myname/mydomainname.com/cgi-bin/hello.pl
My home directory is located on Voss - a name of DH’s server (voss.dreamhost.com)


#4

I misread your shell prompt. Bad Wholly.

Hopefully someone will come by soon with more info. Sorry I didn’t help.

Wholly - Use promo code WhollyMindless for full 97$ credit. Let me know if you want something else!