Forum Moderators: coopster
Code:
if(!is_dir($dirname)) {
$old_umask = umask(0);
mkdir("$dirname", 0777);
umask($old_umask);
$file = '/files/index.php';
$newfile = '/$dirname/index.php';
if (!copy($file, $newfile)) {
echo "failed to copy $file...\n";
}
} else {
echo "URL taken";
die();
}
The PHP script is being executed by the web server, which typically runs under the "nobody" user account (a security tactic since this account has minimal privileges). It might be that the relevant set of permissions for the dirctory that apply to the web server is the last three (for others) - i.e., read and execute. If you do a listing on the directory containing the created directories, can you see which user account owns the created directories? What happens if you set the permissions to 777 (meaning everyone can write to them)?