Apache module & perl problem

I have a very strange problem that I can't seem to solve.

I have apache module which filters content and within that module I will add some more content based on this calls:
int check;
check = system("/usr/bin/check");

check is a perl-script that exits with value 1 if the file doesn't exist and 0 if it does exist.

The problem with this is that it only works for some accounts, not all. I have a structure like /www/domain/a/b/c/abc/htdocs and it checks if the file exists in /www/domain/a/b/c/abc by using "pwd" and then check for the htdocs directory and check the directory below it.

What kind of rights are needed to do this call? I believe it has to do with some kind of permission-problem since I have it working on two accounts, both who have files and directories belonging to root. The other accounts, that just are "normal" and belongs to themselves, can't seem to do the call properly. It always returns 1 for them, whether the file exist or not.

How can I check if it has to do with some kind of permissions? I've tried changing the permissions on the files from the other accounts, but it didn't show any change.

I hope you guys can help me out:)

It would be helpful if you could post:

  1. Sample output of your process table output so we can see the process uid and group of your apache processes; and
  2. The output of ls -la of your file /usr/bin/check; and
  3. The uid and gid of any files called by /usr/bin/check

Thanks.

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
14560 vhostswww 15 0 27400 14m 3936 S 0.7 0.2 0:00.07 apache2

-rwxr-xr-x 1 vhostswww vhosts 129 2009-02-11 15:50 /usr/bin/check
Uid: ( 2001/vhostswww) Gid: ( 2001/ vhosts)

-rw-r--r-- 1 vhostswww vhosts 0 2009-03-20 07:06 .ads (placed in /www/domain/a/b/c/abc directory)
Uid: ( 2001/vhostswww) Gid: ( 2001/ vhosts)

The check file looks like this:

#!/usr/bin/perl
$curdir = `pwd`;
chomp $curdir;
$curdir =~ s/\/htdocs.*//;
if(! -e "$curdir/.ads") {
exit 1;
} else {
exit 0;
}

If there's anything more that is needed, just ask..

Thank you so far:)