Apache module & perl problem


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Apache module & perl problem
# 1  
Old 03-20-2009
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 outSmilie
# 2  
Old 03-20-2009
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.
# 3  
Old 03-20-2009
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:
Code:
#!/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 farSmilie

Last edited by Yogesh Sawant; 03-25-2009 at 07:41 AM.. Reason: addde code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl Oracle DBI through Apache problem

Experts, I've been struggling with making a Perl Oracle DBI script to work through my Apache webserver. Mysql DBI scripts work fine, but I'm having issue's with Oracle. The oracle script works on command line, but I'm getting an "Internal Server Error" with apache Sourcing the oracle... (0 Replies)
Discussion started by: timj123
0 Replies

2. Solaris

Compile PHP as an Apache module on Solaris

Hi, I need to install php 5.5.30 as an apache (2.4.17) module on Solaris 10. Please any help is wellcome. Some aditional info: /usr/sfw/bin/gcc -v Reading specs from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/specs bash-3.2# g++ -v Reading specs from... (0 Replies)
Discussion started by: lbslbs
0 Replies

3. Proxy Server

Problem with Installing Perl Module in Fedora 20

Hi, I have downloaded Audio::Beep. I tried to install it through CPAN but i got YAML error. Then I have tried to install it manually. I tried all the instructions provided in README file. It worked but when i am compiling , it still gives me error: # ls acct21.pl~ imap(2).pl ... (15 Replies)
Discussion started by: zak100
15 Replies

4. Web Development

Apache module development on apache 2.2

Hi, I'm new to developing modules for Apache. I understand the basics now and can develop something simple which allows a 'GET' request to happen, but what I want to do is actually 'POST' information to my site. I know the basic POST Request works and I can see that it is post by looking at... (2 Replies)
Discussion started by: fishman2001
2 Replies

5. Shell Programming and Scripting

problem during perl module installation

Hi 'm getting error while installing perl mdule on linux.can any one tell me how to resolve that error? problem is: CPAN: File::Temp loaded ok (v0.22) CPAN.pm: Going to build J/JD/JDB/Win32-OLE-0.1709.tar.gz OS unsupported Warning: No success on command Warning (usually harmless):... (1 Reply)
Discussion started by: kavi.mogu
1 Replies

6. Shell Programming and Scripting

Facing problem in XML::parser module in PERL

HI, I have XML file which is having values as Spanish character (UTF-8 encoding). I am using XML::parser module but my code is not able to read those characters. I did goggling but not able to find suitable solution. Anybody please help me out. XML file having characters like: ñ I am... (1 Reply)
Discussion started by: jatanig
1 Replies

7. Shell Programming and Scripting

Perl - problem with CPAN module XML::Simple

Hi All, I am trying to run the following program #!/usr/bin/perl # use module use XML::Simple; use Data::Dumper; # create object $xml = new XML::Simple; # read XML file $data = $xml->XMLin("dump.xml"); # print output print Dumper($dump); At first i had the error mesage saying... (5 Replies)
Discussion started by: userscript
5 Replies

8. UNIX and Linux Applications

Apache module compilation error

I'm trying to compile an apache module (a tutorial module, Apache 2 Module Tutorial - GNU Build Tools and the Development Environment) and I get errors like this: apr.h:273: error: expected ´=´, ´,´,´;´,´asm´ or ´__attribute__´ before ´apr_off_t´ those errors occur like 30 times in different... (4 Replies)
Discussion started by: hjalle
4 Replies

9. UNIX for Dummies Questions & Answers

Howto locate locally installed Perl module for a CGI script in APACHE .htaccess

Hi, I have the following simple CGI script, just containg header: #!/usr/bin/perl -w use CGI ':standard'; use lib "/home/myname/lib/perl5/site_perl/5.8.5/"; use Mail::Sendmail; I also have included this directive in ~/public_html/.htaccess : SetEnv PERL5LIB... (0 Replies)
Discussion started by: monkfan
0 Replies

10. Filesystems, Disks and Memory

Mog_Gzip a Module For Apache

Mod_gzip, at http://www.remotecommunications.com/apache/mod_gzip/ is a module for Apache that allows you to compress content from an Apache web server on-the-fly. It uses the same compression as gzip and no plugins or extra software is needed by your browser to take advantage of this product.... (0 Replies)
Discussion started by: binhnx2000
0 Replies
Login or Register to Ask a Question