I want to execute cgi files from /var/www/html/cgi-bin and /var/www/html/s1/cgi-bin. I currently have this in my httpd.conf

Options Indexes FollowSymLinks ExecCGI
ScriptAlias /cgi-bin/ "/var/www/html/cgi-bin/"

# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all

Cgi files in /var/www/html/cgi-bin work perfectly but when I try to execute /var/www/html/s1/cgi-bin/test.cgi, I get errors saying I can't execute a directory /var/www/cgi-bin and that /var/www/cgi-bin/test.cgi does not exist.

How can I fix this problem?


Make sure the ScriptAlias place is in the "mod_alias" directives. (tags).

<IfModule alias_module>
    ScriptAlias /cgi-bin/ "C:/xampp/cgi-bin/"

Edit: Of course use linux folder systems and not "C:/" etc.

  • When I first installed httpd, the mod_alias directives were not there – Matthew Hui Sep 5 '11 at 0:34
  • So add them. It should fix your problem. – U4iK_HaZe Sep 5 '11 at 1:44

Got it working by adding to httpd.conf

<Directory "/var/www/html/s1/cgi-bin">
    Options +ExecCGI -Indexes
    AddHandler cgi-script cgi pl
  • Ah, okay. Close enough. But that makes sense. Good luck to you. – U4iK_HaZe Sep 5 '11 at 7:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.