views:

405

answers:

2

You will laugh if you read to the end of this :) This is now driving me nuts - can't get php to include an existing file with proper permissions set etc.

I have test.php file and "lib/tools.php" file.

I run the following code:

$fn = 'C:\Sasha\ThreeDiamonds\www\lib\tools.php';
if(file_exists($fn)){
    echo "Trying to INCLUDE THE BLoody file: $fn";
if(require_once($fn)==false) echo("failed to include: ".$fn);
}

and get the following:

Trying to INCLUDE THE BLoody file: C:\Sasha\ThreeDiamonds\www\lib\tools.php Warning: require_once(C:\Sasha\ThreeDiamonds\www): failed to open stream: Permission denied in C:\Sasha\ThreeDiamonds\www\test.php on line 5 Fatal error: require_once(): Failed opening required '' (include_path='.;C:\php5\pear') in C:\Sasha\ThreeDiamonds\www\test.php on line 5

Now, this is running Windows/IIS and recent version of php.

The following works fine if I call another php file from same with tools.php directory with the following code in it:

require('tools.php');
$mytools = new tools();
$mytools->ShowGallery();

This is driving me really mad :) IIS is setup to annon auth with app pool identity - I can see php-cgi.exe is running under Local Service account and I did make sure tools.php effective permissions allow full access for this account.

I enabled security auditing for this tools.php file for failed attempts and it's not showing any issues.

ok, I went ahead and installed ProcMon to see what's going on here. All I get is "FAST IO DISALLOWED" for "Query Open" operation. Mmmmm? Windows7 yeah.

I'm lost, please help :)

A: 

Never mind - got this sorted.

The issue in fact had nothing to do with permissions: had a error in tools class constructor and this was causing this. Why was php throwing this permission error - that's another question :)

Thanks, all!

abolotnov
Mind telling us? ;)
Anthony Forloney
Please answer your own question then so others with similar problems can benefit later.
ChristopheD
undefined index in tools class constructor was causing this. Weird that I was getting fatal permission error instead of a non-fatal warning.
abolotnov
A: 

Looking at the exact path the warning throws, it still looks like a permission problem with the www directory or the one below (ThreeDiamonds)

Could it be that C:\Sasha\ThreeDiamonds has a permission problem while the directories below do not? That would account for why it works with a relative path.

Pekka
well, I have checked for Effective permissions - as longs as these are fine access will be provided.In fact, the issue had nothing to do with permissions I will update my answer to explain the details.
abolotnov