I created the following Alias in httpd.conf:

alias /aliasedfolder /some/location/on/the/server/folder
<Location /aliasedfolder>
  AddHandler cgi-script .pl
  Options +FollowSymLinks +ExecCGI
  Order allow,deny
  Allow from all
  AllowOverride None

The problem is that i can view images within "aliasedfolder" but i am getting a "file does not exist" error when i run a perl script there, e.g. /aliasedfolder/script.pl.

The physical perl script exist in "/some/location/on/the/server/folder".

I made sure the script has 755 permission.

Below is the contents of the perl script:

use CGI qw/:standard/;
print "Content-type:text/html;\n\n";
print "Hello world";

What seems to be the problem?

  • Forget about the logfiles (can't delete the comment). – ott-- Dec 11 '12 at 20:59
  • What is your documentroot ? And "/some/location/on/the/server/folder" is an absolute or a relative (to documentroot) path ? – Nikolaidis Fotis Dec 11 '12 at 23:25
  • I see that this has been solved but shouldn't you be using "ScriptAlias" anyway? – igelkott Feb 26 '13 at 12:49

After checking the ownership of /some/location/on/the/server/folder, I found out that the owner is the "root" username, whileas I was trying to access the folder through an account (domain name) on Apache that has a different username, e.g. domain.com/aliasedfolder/script.pl

The suexec mechanism is preventing this as a security feature. So, I changed the ownership of the /some/location/on/the/server/folder and the script.pl file inside it from "root" to my account's username and group, and it is working now.

This will prevent other domains pointing to my server from accessing this file (script.pl), as suexec prevents a single file to be shared by multiple domains (which have different usernames).

I can disable the suexec mechanism altogether, but I was advised not to do so due to security concerns.

Thanks for all who tried to help.


Have you tried using a

<Directory "/some/location/on/the/server/folder" >
    AddHandler cgi-script .pl
    AllowOverride None

Also are you running any security measures, such as suExec or SELinux, if you are there are additional ownership and extended attributes tweaks required for your scripts.

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.