If you're on a shared *nix server, a directory created through mkdir() will not be assigned to you, but to the user that your host's server or php process is running under, usually 'nobody', 'apache' or 'httpd'.
In practice, this means that you can create directories, even add files to them, but you can't delete the directory or its contents nor change permissions.
It is therefore advised to create directories through PHP's FTP API. Here's a function I wrote:
<?php
function FtpMkdir($path, $newDir) {
$server='ftp.yourserver.com'; $connection = ftp_connect($server); $user = "me";
$pass = "password";
$result = ftp_login($connection, $user, $pass);
if ((!$connection) || (!$result)) {
return false;
exit();
} else {
ftp_chdir($connection, $path); if(ftp_mkdir($connection,$newDir)) { return $newDir;
} else {
return false;
}
ftp_close($conn_id); }
}
?>
Hope this comes in handy for someone.