LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 02-15-2012, 10:21 AM   #1
markseger
Member
 
Registered: Jul 2003
Posts: 241

Rep: Reputation: 25
Apache, perl and glob aren't playing nicely together


First and foremost, I have to say this works fine on an older RHEL5.3/Apache system. Look at this code:

Code:
#!/usr/bin/perl -w

my $foo='/tmp/*';
my @glob=glob($foo);
my $size=scalar(@glob);

$foo='/usr/*';
@glob=glob($foo);
my $size2=scalar(@glob);

$foo='/tmp2/*';
@glob=glob($foo);
my $size3=scalar(@glob);

print "Content-type: text/html\n\n";
print "<html><head>\n";
print "SIZE: $size  SIZE2: $size2 SIZE3: $size3\n";
print "</head></html>\n";
All it does is a glob to return a list of the number of files in 3 different directories and report how many there are. Running from a shell, it produces exactly what I'd expect. However if I put the code into /var/www/cgi-bin and invoke it from a browser it reports 0 for both /tmp and /tmp2.

My initial thought was (and still is) it might be some sort of permission problem so I did "su apache" so I could be the same user as the webserver and when I run from the command line it still works correctly. So it's not the user but the webserver itself that is causing this odd behavior.

This is driving me crazy and I'm out of ideas. Anyone have any suggestions for what other tests I might try?

Btw - if I count the files using opendir/readdir, it does work correctly and I may ultimately have to redo my code to use them, but I'd really like to understand what's going on and whether or not this might be a bug in mod_perl.

-mark
 
Old 02-19-2012, 04:54 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Output of 'getenforce' ?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with glob - perl invoked from shell johngreg Programming 16 11-12-2008 03:33 PM
[Perl] unlink/ glob and warn noir911 Programming 1 12-11-2006 06:55 AM
[Perl] unlink/ glob and warn noir911 Programming 1 12-11-2006 05:55 AM
Nvidia not playing nicely with TV Wonder VE Ben64 Linux - General 3 03-05-2006 08:52 PM
Knewsticker/Konqueror not playing nicely jhimes Linux - Software 1 02-23-2005 12:41 AM


All times are GMT -5. The time now is 09:16 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration