I am making an application in php and i have to test certain directories(lets say "abc" folder) file permissions and i have to create a new file dynamically ,lets say "file" in directory "xyz" .. I want "abc" to be readable and writable by webserver(i.e. 666) and in order to be able to create file in directory "xyz" am checking it for readable and writable mode too(i.e. 666)... And here is what it prints xyz directory - 777 abc directory - 777
But when i try to
$data = 'Some file data';
$fh = fopen($rootdir."\\file.php","r+");
if ( !fwrite($fh,$data))
{
//echo $rootdir;
echo 'Unable to write the file';
}
else
{
echo 'File written!';
}
fclose($fh);
$rootdir contain address of folder "xyz" ... It shows following error
Message: fopen(C:\inetpub\wwwroot\file.php) [function.fopen]: failed to open stream: Permission denied
As i said C:\inetpub\wwwroot file permissions are 777.. And initially file.php don't exist but fopen will create it.. isn't it? And in case it won't, how can i create file dynamically?
Any help ?