SPUG: perls 'test' -d cgi vs. command line.

Matthew Bustad mybustad at gmail.com
Fri Feb 18 09:59:28 PST 2011


On Thu, Feb 17, 2011 at 4:19 PM, Andrew Sweger <andrew at sweger.net> wrote:
> On Thu, 17 Feb 2011, Matthew Bustad wrote:
>
>> The -d test of if /pub/git is a directory (it is) fails via cgi, but
>> (as user apache)
>> works via command line?
>
> If "via cgi" is a web server, does the user the web server is running
> under have permission to look in /pub?
>
> --
> Andrew B. Sweger -- The great thing about multitasking is that several
>                                things can go wrong at once.
>
>

Cut down to a minimal test:

----8<----Start
Code----8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<----
#!/usr/bin/perl


open(O, ">>/tmp/fo");
my $projects_list = "/pub/git";
  printf(O "+++\n\n" );
if (-d "/pub/git") {
  printf(O "++++++\n\n" );
}

# print header
printf("Status: 200 OK
Content-Type: text/html; charset=utf-8\n\n");

# print some body
printf("<html><head><title>dtest</title></head><body>TEST</body></html>\n");

----8<----End  Code----8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<----

Stock CentOS 5.5 Apache.

I will dig deeper into the http configuraiton files (stock).

-- Matthew


More information about the spug-list mailing list