Ok, I have a clue to the symptoms but no answer to the problem yet.
The opendir() and copy() fail because of the way the directory is created. The script uses the following to create the upload directory
PHP Code:
if (!is_dir("$absolute_path/$PHP_AUTH_USER")) {
$oldumask = umask(0);
mkdir("$absolute_path/$PHP_AUTH_USER",0777);
umask($oldumask);
if ($indexfile =
fopen("$absolute_path/$PHP_AUTH_USER/index.html", "a")) {
$timenow = time();
$name = strip_tags($PHP_AUTH_USER);
fwrite($indexfile, "");
fclose($indexfile);
}
}
With this code, the directory is created but the owner is "apache." When the owner is apache, the opendir() and copy() don't work in the script.
But if I manually create any directory that I plan to use, instead of the program doing it, everything works fine. I can upload and the opendir() and copy() work fine.
How does one change the script to avoid this problem? I believe it is normal for "apache" to be the owner of something created from the script but why doesn't the copy() and opedir() work for a directory that has "apache" as the owner? Any way around this?