ID: 12699 Comment by: matthias at rakplanet dot de Reported By: [EMAIL PROTECTED] Status: Closed Bug Type: Directory function related Operating System: Win32 PHP Version: 4.0CVS-2001-08-11 New Comment:
W2K + ISS + "openDir()" i had the same problem with "openDir()" with W2K and ISS. In attributes of the directory you want to open in the field "security adjustments" (sorry, im trying to translate it from German) there is a checkbox "take inheritable superior authorizations" (it is also a attempt to translate german text). I set this attribute and "openDir()" works fine. Previous Comments: ------------------------------------------------------------------------ [2003-04-29 14:47:39] par at parwebworks dot net I changed the permissions in my inetpub directory to full access for the IUSR account (which I assume IIS uses for php to do file operations). Ofcourse full access is a bit much but, it works ;) I'm not sure if this is the place for codes but figured I'd post my recursive files/directory reader function I wrote based on tons of "whatever is this supposed to work?" codes on the php.net pages. Tried to add a comment there but all I got was a "phpschool.com" page not found error... so, if it's any useful, here it goes.. it's very basic and just gives a nice output of my full inetpub dir. <?php rec_readdir("e:\inetpub\wwwroot"); function rec_readdir($dirname) { if ($dir = opendir($dirname)) { while (false !== ($file = readdir($dir))) { if (($file !=='.') && ($file!=='..') && ($file !== $dirname)) { $checkdirname = $dirname."\\".$file; if(is_dir($checkdirname)) { echo "<BLOCKQUOTE>\n"; echo "<B>recdir: $checkdirname</B><BR>\n"; rec_readdir($checkdirname); echo "</BLOCKQUOTE>\n"; } else { echo "$dirname\<I>$file</I><BR>\n"; } } } closedir($dir); } } ?> ------------------------------------------------------------------------ [2003-04-29 13:54:24] par at parwebworks dot net Just noticed the topic is closed but... It indeed is a security issue. On my server (win2k) I get the same error as the original author who has this problem. When using IIS (which I think he is), the IUSR_GUEST (wrong spelling but check your security rights on a directory it's something like that) needs read permissions on a folder for php to be allowed to access it. It's weird though that php generates this weird error rather than say "permission denied" which I would find a lot more obvious.. but then again, who would run IIS and php right? When using my C:/inetpub/wwwroot as folder, the opendir works just fine and that has IUSR_guest access... just fool around with those permissions and I'm sure you'll get it to work. ------------------------------------------------------------------------ [2002-11-11 17:59:04] xenosis2000 at hotmail dot com By the way.. I still can't get it to work.. help appriciated. ------------------------------------------------------------------------ [2002-11-11 17:58:26] xenosis2000 at hotmail dot com I ran into something similar with trying to OpenDir to a mapped network drive. Variable Define: $logpath = "s:\dir\System\"; Use it: $handle=opendir($logpath); Error: Warning: OpenDir: Invalid argument (errno 22) in logs.php on line 45 ------------------------------------------------------------------------ [2001-10-02 18:38:38] [EMAIL PROTECTED] No feedback, considered fixed. (naughty, naughty Sebastian.. :) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/12699 -- Edit this bug report at http://bugs.php.net/?id=12699&edit=1