adrive has asked for the wisdom of the Perl Monks concerning the following question:

im sorry i have to post it here, since even apache's forum doesn't seem to be active at all.

I was wondering if there is any way to grant access to perl scripts execution to all my aliased directories without having to put +ExecCGI to each one of them?

I tried putting +ExecCGI on the default directory :

<Directory /> Options Indexes FollowSymLinks +ExecCGI AllowOverride None Order deny,allow Deny from all </Directory>


Then on one of my aliased directories :

Alias /EclipsePDTWorkspace "C:\EclipsePDTWorkspace/" <Directory "C:\EclipsePDTWorkspace/"> Options Indexes FollowSymLinks MultiViews AllowOverride all Order allow,deny Allow from all </Directory>


Accessing perl scripts won't work on EclipsePDTWorkspace unless I put +ExecCGI on it as well. Is there any way to tell apache that I want all my other folders to have access to perl without having assigned each of the individual folders?

Replies are listed 'Best First'.
Re: perl and apache 2 on windows xp
by jethro (Monsignor) on Apr 18, 2008 at 04:22 UTC
    Btw. the line Options Indexes FollowSymLinks +ExecCGI is not valid syntax. Option lines without any +- set the options while option lines with all +- merge them with the options of outer sections.

    See "Options" in the apache documentation.

    EDIT: Oh, didn't realize: That could also be the reason why +ExecCGI doesn't work for you. You would have to change all the option lines in the other directories to use + and -, so that they don't overwrite your setting of ExecGCI in the root. And in the root the '+' in "+ExecCGI" should be removed.

    Changing the option lines to +- changes their logic. So instead of reworking every options line it might be easier to just add an 'ExecCGI' after all.

Re: perl and apache 2 on windows xp
by jethro (Monsignor) on Apr 18, 2008 at 02:18 UTC
    Since you seem to be on windows, shouldn't the first line above read <Directory c:\> or something.
    Unfortunately 'Options' directives are ignored inside 'Location'-sections, so if you wanted to specify the options for the document root, that won't work.

    Just a guess, I don't know anything about apache on windows.

Re: perl and apache 2 on windows xp
by Anonymous Monk on Apr 18, 2008 at 03:05 UTC

    I presume you do have the line:

    AddHandler cgi-script .cgi .pl

    somewhere in your conf file?

Re: perl and apache 2 on windows xp
by adrive (Scribe) on Apr 18, 2008 at 04:13 UTC
    ah..yes, i do have it enabled.

    actually, i could run my perl programs. The only problem is that I had to set each directory (aliases) with +ExecCGI in order for it to work.

    I thought maybe there was a way to set it at a root folder so that the rest don't need to. But i can't seem to set it to C:/ though.
Re: perl and apache 2 on windows xp
by adrive (Scribe) on Apr 18, 2008 at 02:59 UTC
    well setting directory to "C:\/" or "C:\" didn't seem to work either.

    it's quite peculiar that php on apache2 doesn't to have all its aliased directories adding php support but perl.

      I'm assuming you recognise the security implications. I just tested this on my Apache 2 httpd.conf on XP (and restarted the service of course)

      Alias /C/ "C:/" <Directory "C:/"> Options ExecCGI </Directory> AddHandler cgi-script .cgi .pl

      I put a test script in C:/tmp and called it using http://localhost/C/tmp/test.pl. The security implications should be obvious as I can now exec a CGI anywhere in the directory tree. Note your scripts must have a shebang line that points to perl or you will get an internal server error. My perl is at C:\perl\bin\perl.exe location. Note you use / slashes everywhere with Apache. As a useful note you can use / where you think you need a \ in your Perl on Win2K onwards and it will work just fine ie open FILE, "C:/dir/file.txt" will work.

      !#C:/perl/bin/perl.exe