Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is_dir not evaluating

Status
Not open for further replies.

DeepBlerg

Technical User
Jan 13, 2001
224
AU
Hi,

I'm trying to create a script that find whether directory names in an array don't exist on the server. Here's what I have:

Code:
foreach($value_array as $val) {
	if (!is_dir("/home/virtual/" . $val["Domain"])) {
		echo "The folder: " . $val["Domain"] .  " is not on the server";
	}
}

However, the output from this is wrong. It returns some folders that are on the server and also doesn't show some folders which aren't on the server. I know is_dir works on the server cos I've used it in another script. Could it be that the size of the $value_array is about 50, might be doing some weird timeout or something on the server.

I also tried !opendir and !chdir instead of !is_dir but still outputs the same wrong data.
 
No, I do mean "also doesn't show some folders which aren't on the server".

Basically I have an array like this:
site1.com
site2.com
site3.com
site4.com

If on the server, there are two directories called:
site1.com
site2.com

I would expect the output from the PHP to say:
site3.com
site4.com

But it instead would list:
site2.com
site3.com

as an example. In other words "!is_dir" isn't doing what it's meant to. I'm pretty sure the permissions are fine too.
 
Oh, so your feeding the loop a list of directory names which may or may not appear on the filesystem.

What does your script do if you modify it to look for those directories that do exist? Does is_dir() work as expected?

Want the best answers? Ask the best questions: TANSTAAFL!!
 
If all the permissions are correct, my mind would drift towards special characters, and forgive me if I'm being an idiot here, but being that you appear to be in a unix filesystem, are your case sensitivity issues addressed?

Timeout won't cause your problem... timeout might cause it to not display everything it needs to, but it should still be right on everything it displays.


-Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top