I have 2 servers running red hat 9 and php called www2 and www3.
I am trying to run a file search script that will simply run hrough a directory and search for occurrances of a keyword.
The script works on www2 but not on www3. PHP works on both. both php.ini files are identical after chaning one value to on but it still doesnt seem to work.
I would imaging it would be a configuration issue rather than a code issue but i am open to any suggestions if anyone has any ideas.
Thanks in advance.
File Browsing With PHP?
Moderator: General Moderators
You want PHP to do the job?
A nudge in the right direction would be:
That'll return subdirectories and files in a directory. If you filter the array it returns with a search-function, you should get what you need.
A nudge in the right direction would be:
Code: Select all
<?php
function get_directory_contents($path){
$mydirectory = opendir($path);
while($entryname=readdir($mydirectory)){
switch (true){
case ($entryname==".") : break;
case ($entryname=="..") : break;
case (is_dir($path."/".$entryname)) : $return["dir"][]=$entryname; break;
default : $return["file"][]=$entryname;
}
}
closedir($mydirectory);
return $return;
}
echo "<h3>directory contents</h3><pre>";
print_r(get_directory_contents("./"));
echo"</pre>";
?>