Page 1 of 1
Very Odd opendir problem.
Posted: Fri Nov 15, 2002 12:59 pm
by Owe Blomqvist
Hi.
I´m currently writing a log parser for iis.
But i ran into a strange problem.
When i do:
Code: Select all
$log_path = opendir('C:\\WINNT\\system32\\LogFiles\\MSFTPSVC1');
while (false !== ($files = readdir($log_path)))
{
echo "$files<br>";
}
I get: "Warning: OpenDir: Invalid argument (errno 22) in D:\WWWserver\___WWW_ROOT___\IIS_PARSER\TMP4vynw5mscg.php on line 4"
The directory exists allright, but when i do:
Code: Select all
$log_path = opendir('C:\\WINNT\\system32\\LogFiles');
while (false !== ($files = readdir($log_path)))
{
echo "$files<br>";
}
It works fine.
I get the directory listed, which i wanted to open.
Anybody has any ideas?
I have checked file permissions. That´s not the problem.
/Owe Blomqvist
Posted: Sat Nov 16, 2002 11:29 pm
by volka
maybe the account php (and the webserver) is running on has no access permissions for this directory
Posted: Sun Nov 17, 2002 9:31 am
by Owe Blomqvist
I can open all folders on the computer i have tried, except the actual log folder.
I don´t know how to work around this.
I have tried all kinds of various things but without luck.
The only thing i could do , (atleast as it seems) is to manualy copy the log files into another directory. But this is not what i want.
I hope somebody out there has a work around for this.
/Owe Blomqvist.
Posted: Sun Nov 17, 2002 10:04 am
by volka
even if
Code: Select all
is_readable($dirname) or die ('not readable');
//is_executable($dirname); doesn't work at all on win32
does not stop the script it is possible on php/win32 that the script has no access to the folder.
afaik
Warning: OpenDir: Invalid argument (errno 22) always mean either not a local directory or access denied.
If you (as user) have access to this directory you may try your script with php-cli.exe
Posted: Mon Nov 18, 2002 1:17 pm
by Owe Blomqvist
Hmm...
Okeis. Thanks.
Where can i find this php-cli.exe?
Posted: Mon Nov 18, 2002 8:02 pm
by volka
it's within the zip-package of php/win32 at
http://www.php.net and is
simply the command line version of php (in opposite to the
normal cgi php.exe)
Posted: Tue Nov 19, 2002 3:12 pm
by Owe Blomqvist
Thank You very much for the help.
I´m Downloading php-cli.exe & searching for info on how to use it.

/Owe Blomqvist.
Posted: Tue Nov 19, 2002 4:45 pm
by Owe Blomqvist
One question...
How do i use it?
I´ve been reading the php installation file & all i see is:
Code: Select all
Please note that you cannot use php-cli.exe with your webserver, you need
to use php.exe which can be found in the sapi directory of your PHP
distribution.
Sorry for bugging you with this newbish questions.
Best regards,
Owe Blomqvist.
Posted: Tue Nov 19, 2002 4:53 pm
by Owe Blomqvist
I found the error.
If anybody is interested, it was a registry key that caused this.
I found by setting "Guest Access" to 1 it works fine.
I don´t know if it is a security risk enabling it though.
Code: Select all
їHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSFTPSVC\Parameters]
"AllowGuestAccess"=dword:00000001