When you're writing CGI programs for the Web (C++ executables, Perl scripts at the like), you might sometimes get a 500 Internal Server Error The Server was unable to complete your request or somesuch. This essentially means that something went wrong, but no more than that. Even the error logs, if you have access to them, can be helpful if there's a genuine error in your program. However, all it might say is 'Premature End of Script Headers'.
This might mean that you forgot to send the regular HTTP response header(s) in your code, and this is covered ad nauseam on the Web already.
Less likely, it might mean that the permissions are wrong on the program or its parent directory (or directories). A CGI program must be readable and executable by the web server for it to run.
Much less likely, but suitably frustrating if you don't think of it, is that on some server configurations you'll get this error if the program isn't owned by the correct user, or is in the wrong group. root specifically may be disallowed. This may seem like security consciousness gone mad, but in truth it cuts down on hacking attempts -- usually by webmasters on shared servers, trying to sniff about the system.
Still stuck? There's one more thing that will give you the dreaded 500: The program is located in a directory outside of the 'allowed' web-space. The reason for this requirement is the same as for the user/group limitation above. You will simply have to copy the script to somewhere within the web server's allowed filespace. Even using symbolic links may not work.
You could of course get these situations with any program, but the one that you might feel inclined to install, and be relieved that it comes with its own configuration program, is awstats. It's a fine and dandy web-stats package, written purely in Perl; in fact, the awstats.pl script stands at over 500kB in size, plus other config-style library files. Despite being able to insert Apache directives and install itself into a location of your choosing, the installation script doesn't warn you about any of the above points. You will most likely end up with awstats installed in /usr/local/awstats and owned by root. Basically, having set your directives correctly in your webserver, and restarted the webserver as well, a 500 error when trying to run awstats.pl will most likely be a file ownership or location problem.
Remember, you must fix everything before it will work!
John Swindells I am a career professional in software development, becoming proficient in various systems and languages since 1992. In recent years I have been especially active in web and mobile app projects. I stepped down in April ... (more)
Here are the command-line steps needed to get a bare CentOS 8.0 distro ready for full LAMP (Apache-MySQL-PHP) hosting: (Note - replace mysite.com with the domain name of your own website, and server1.mysite.com with this server's hostname ... (more)
I'd always been nervous about replacing the push-fit bearings myself. I'd always been used to the screw-on variety, and when I bought a Specialized Crux with BB30 push-fit bearings I just left it as a job for my LBS when the dreaded creak ... (more)
Bicycle seatposts are notorious for getting stuck in the frame. They're in a fairly vulnerable part of the bike, and rainwater can work its way down - causing the post to corrode over time. The act of corrosion is fairly slow, so you should ... (more)