hey guys apparently directory functions such as opendir, and scandir are not working on my host.
following is the code, its from php.net.

the output is keep on coming fail.
is there something wrong with my php settings or something else.

the page is,

http://worldofpakistan.net/try/write.php

<?php

$dir = "http://www.worldofpakistan.net/";
$dh  = scandir($dir);
if($dh)
{
echo "success";
}
else
{
echo "fail";
}

while (false !== ($filename = readdir($dh))) {
    $files[] = $filename;
}

sort($files);

print_r($files);

rsort($files);

print_r($files);

?>

Recommended Answers

All 3 Replies

replace 'echo "fail";'
with print_r(error_get_last());

im getting the following output:

Array ( [type] => 2 [message] => scandir() [function.scandir]: (errno 25): Inappropriate ioctl for device [file] => /home/worldofp/public_html/try/write.php [line] => 7 )

instead of the list of files and directories.

I've never seen that error and there's not much documentation on it so I would assume that it is a problem at the server level.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.