RE: problem to open dir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Definitely use the is_dir() function as Rafael suggests. Also, make sure
that the user that PHP will be running as has permissions to read from that
location. I had some troubles a while back reading, writing and deleting
from some locations that the user IIS was running as did not have the proper
permissions in that location.

So if is_dir() returns true for you but you're still having those issues,
try explicitly adding the user that apache is running as to that directory
with some good permissions.

Oh - and about the slashes, only use the \\ when you're using double quotes
and only use \ with single quotes. Double quotes tells PHP to try to
evaulate the contents of the string (replace varables with their value,
interperate \[character] with their proper escaped value, etc.) while single
quotes tells PHP that "treat this value as exactly what's entered - don't
try to evaulate anything".

-M

> -----Original Message-----
> From: Rafael Soares [mailto:design_animation@xxxxxxxxxxxx] 
> Sent: Tuesday, November 30, 2004 6:11 AM
> To: luis.moreira@xxxxxxxxxxxxxxx; php-windows@xxxxxxxxxxxxx
> Subject: RES:  problem to open dir
> 
> Hello!
> 
> The sintax I use is this:
> 
> $dir = 'C:\\dir\\subdir\\';
> 
> But I haven't tried to access windows dirs like Documents and Settings
> 
> The only way to be sure is using the is_dir(); function.
> 
> See you.
> 
> Rafael Soares - AgênciaM
> Fone:  +55 11 4616-1394
>  
> -----Mensagem original-----
> De: Luis Moreira [mailto:luis.moreira@xxxxxxxxxxxxxxx]
> Enviada em: terça-feira, 30 de novembro de 2004 08:04
> Para: Pravin-Kumar
> Cc: php-windows@xxxxxxxxxxxxx
> Assunto: Re:  problem to open dir
> 
> Remove the double quotes.
> 
>  $dh = opendir('F:/vyapar-2/test/cdaci');
> 
> 
> Pravin-Kumar wrote:
> 
> >hi list!
> > 
> > $dest='F:/vyapar-2/test/cdaci'; or
> > $dest='F:\vyapar-2\test\cdaci'; or
> > $dest='F:\\vyapar-2\\test\\cdaci'; or
> > $dh = opendir($dest);
> > $a=dir($dest);
> >
> >the above code giving following problem on apache 1.3  on windows
> >
> >Warning: opendir(F:/vyapar-2/test/cdaci): failed to open 
> dir: Invalid 
> >argument in G:\Vyapar-2.0\test\1.php on line 10
> >
> >Warning: dir(F:/vyapar-2/test/cdaci): failed to open dir: Invalid 
> >argument in G:\Vyapar-2.0\test\1.php on line 11
> >
> >--
> >Nothing is working i had tried \\ , /, "double quot", 'single quot'
> >
> >---------
> >Regards
> >Pravin Kumar
> >
> >On Tue, 30 Nov 2004, Mike wrote:
> >
> >  
> >
> >>When you set the $dir variable, try doing so with single 
> quotes - the 
> >>\ character is used to escape things and might be causing 
> some problems.
> >>
> >>If that makes no sense, it's because I'm falling asleep.
> >>
> >>Good luck.
> >>
> >>-M
> >>
> >>    
> >>
> >>>-----Original Message-----
> >>>From: Pravin-Kumar [mailto:pravin@xxxxxxxxxxxx]
> >>>Sent: Tuesday, November 30, 2004 12:37 AM
> >>>To: php-windows@xxxxxxxxxxxxx
> >>>Subject:  problem to open dir
> >>>
> >>>hi all
> >>>i am getting some unexpected error while try to read a local dir..
> >>>it is working on the pc where apache is running ..but same 
> code not 
> >>>working while trying from other pcs in lan..
> >>>here is code..
> >>>$dir="C:\Documents and Settings\pravin\Desktop\abcd2"; if
> >>>(is_dir($dir)) {
> >>>    if ($dh = opendir($dir)) {
> >>>       while (($file = readdir($dh)) !== false) {
> >>>          echo "filename: $file : filetype: " . filetype($dir . 
> >>>$file) ."\n";
> >>>       }
> >>>       closedir($dh);
> >>>   	 }
> >>>	}
> >>>
> >>>$dir = dir($source);
> >>>
> >>>
> >>>giving error:
> >>>Warning: dir(C:\Documents and Settings\pravin\Desktop\cdac2): 
> >>>failed to open dir: Invalid argument in 
> >>>G:\Vyapar\AdvMgmt\addadvt3.php on line
> >>>69
> >>>
> >>>Fatal error: Call to a member function on a non-object in 
> >>>G:\Vyapar\AdvMgmt\addadvt3.php on line 70
> >>> 
> >>>
> >>>
> >>>
> >>>---------
> >>>Experience is what you get when you didn't get what you wanted.
> >>>---------
> >>>Regards
> >>>Pravin Kumar
> >>>Technical Associate, CDAC, 68, E-City, Bangalore, 560100.
> >>>Registered Linux user #365056; Ph. +91 80 28523300 Extn:2103 
> >>>http://geocities.com/pravin_suman/
> >>>http://pravindeo.blogspot.com
> >>>
> >>>--
> >>>PHP Windows Mailing List (http://www.php.net/) To 
> unsubscribe, visit: 
> >>>http://www.php.net/unsub.php
> >>>
> >>>      
> >>>
> >
> >  
> >
> 
> --
> PHP Windows Mailing List (http://www.php.net/) To 
> unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux