I haven't done anything on a windows machine since I started doing serious sys-admin and development work (all *nix). So I may be asking something easy - but I haven't found the answer by searching.

I've got Windows Server 2008 running Apache 2.2. I can run the "printenv.pl" perl script that came in the cgi-bin dir along with the Apache install just fine...

However, with a script that does the following:

print "Content-Type: text/plain; charset=iso-8859-1\n\n";
print `type C:\\Some\\Dir\\file.txt`;

My apache log just says:

[Tue Jun 22 13:13:55 2010] [error] [client] Access is denied.\r

I can run the same perl script from the dos prompt - so I know it works for my user. I can see in Task Manager that httpd.exe is running with user SYSTEM, so I made sure file.txt was readable to SYSTEM. I even made it readable to Everyone at one point - but I still get the "access is denied" error.



Are you certain that the user 'SYSTEM' can execute perl.exe?

  • Yes, based on the fact that I can run that 'printenv.pl' script through Apache... I checked the properties on the exe as well to be sure... – EMiller Jun 22 '10 at 21:09
  • Are you certain that Apache isn't jailed to the directory? Where exactly is the file.txt? Try moving a copy into the Apache directory it is serving from to make sure. – Tyler K Jun 22 '10 at 21:20
  • That's a good call - I will try asap. What would "jailed" mean on a windows machine? (what controls that, and where is it configured) – EMiller Jun 22 '10 at 22:25
  • I'm afraid you've hit my Windows knowledge wall. I can't answer that and google isn't turning anything up. – Tyler K Jun 23 '10 at 5:48
  • Thanks - well you've pointed me in the right direction ... I've confirmed I can 'type' out a file within cgi-bin ... and even when I add the other path as an apache 'Alias' and add a corresponding '<directory>' section to allow browsing - I get a permission denied... – EMiller Jun 23 '10 at 16:10

Well - it turned out that the C:\some\dir\file.txt file was encrypted. It took me a while, but I finally started to wonder: "why is that folder in green text" in windows explorer. I have no idea why, but I copied a zip file over, and when they extracted they were encrypted. As soon as I turned that off, the perl script could read.

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.