These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for Perl and usr/bin on the new forum.
I've got a cgi script but I keep getting a 500 internal server error.
I don't see #!/usr/bin/perl which it has as the location for perl.
Any help on what the rules are for setting up cgi and pointing to perl would be much appreciated.
Well, assuming your Perl script is using CGI (rather than mod_perl), the path to Perl at the top of the script would need to exist. Even if you are using mod_perl, it can't hurt to have the right path ;-)
So if your Perl binary were in /usr/bin/perl, the script would need #!/usr/bin/perl. If you type 'which perl', that should give you a hint as to where the Perl binary is.
But, anytime you see "500 Internal Server Error", you'll often get a helpful error message in the Apache error log, which might help to point you in the right direction.
-Eric
Now for my second newbie question (and I've been on the system for almost a year...)
Terminal command 'which perl' says usr/bin/perl so that's okay
The error log says 'script not found or unable to stat' (yes, stat not start).
When I tried the test cgi it says 'premature end of script headers'
How can i tell if cgi is enabled?
What is the output of the following command:
ls -l /path/to/your/script.pl
I'm curious if there's some form of permissions issue.
-Eric
Here are the permissions
ls -l /home/ekmb/public_html/cgi-bin
total 20
drwxr-xr-x 2 ekmb ekmb 4096 Jun 24 14:46 data
drwxr-xr-x 3 ekmb ekmb 4096 Jun 24 14:46 html
-rwxr-xr-x 1 ekmb ekmb 4643 Jun 24 14:46 search.cgi
-rwxr-xr-x 1 ekmb ekmb 1398 Jun 24 14:46 test1234.cgi
That's not a working cgi-bin path on Virtualmin. Scripts would execute from /home/ekmb/cgi-bin on Virtualmin systems (you could configure it to execute the way you've set it up, but I wouldn't recommend it--the way security is sometimes implemented in CGI scripts is somewhat different than the way PHP scripts are setup, and so having the cgi-bin within a normal document root can lead to unexpected data exposure).
--
Check out the forum guidelines!
The default template location for cgi-bin is /home/domain/cgi-bin/ NOT /home/domain/public_html/cgi-bin/
Scripts should always be located *outside* the web doc root for security.