Thursday, May 24, 2007

PHP fopen Fails to Open Directory in Windows

fopen Fails to Open Directory in Windows

fopen — Opens file or URL


However, if the file is a directory, fopen will fail to open the directory in windows. This issue does not occur in Linux.

Windows Error:
Warning: fopen(c:\windows\): failed to open stream: Permission denied

Regardless of the permissions on the windows or any other directory, fopen will display the error.

PHP Code:

Windows:
$fh = fopen('c:\\windows\\', 'r');

Linux:
$fh = fopen('/home/test/', 'r');

fopen Fails to Open Directory in Windows

1 comment:

Mati's Blog said...

I'm having the same problem. Did you find a solution?