Even with cgi enabled (mod_cgi) scripts either don't run or run with weird intermittent problems. Sometimes Perl or PHP will run (In this case, you'll notice the perl or PHP modules are installed.) You might also see weird effects with form data, like no env(QUERY_STRING) . sh and bash will only return code without executing.
Debian ships apache2 as a multi-threading (mpm) build. mod_cgi is WRONG for mpm builds. Instead, use mod_cgid. The command syntax is the same for both modules.
- Code: Select all
OTHER THINGS YOU MAY NEED TO DO:
IF you've been messing around trying to fix the issue, you may have rearranged things like ScriptAlias, <directory></directory>, AddHandler. In such a case, you need to re-create the vanilla .conf files that apache installed with (internet or aptitude reinstall. if you're using apt[itude] remember to re-enable cgid and restart apache2.
Just point ScriptAlias to your fav cgi directory and it should run good.
STILL NOT WORKING?
There are cgi tutorials ad-nauseum to address the basic issues (permissions, $PATH, etc). I only wrote this because I haven't seen anybody else post this advice and I lost 20 unbillable hours tracking down the problem. If you've tried everything else, this should get you by.
WHERE CAN I FIND MORE?
There isn't much. Start here: https://httpd.apache.org/docs/2.2/mod/mod_cgi.html