the only problem with mkdir under php in some configurations, is that the directory will be created as a different username, usually 'nobody', 'apache', or 'httpd'. Therefore you will not have permissions to delete the directory or in some cases add files.
This is a code snippet that gets around that problem. Although not as efficient in some cases its the only way.
<?php
// create directory through FTP connection
function FtpMkdir($path, $newDir) {
$server='ftp.yourserver.com'; // ftp server
$connection = ftp_connect($server); // connection
// login to ftp server
$user = "me";
$pass = "password";
$result = ftp_login($connection, $user, $pass);
// check if connection was made
if ((!$connection) || (!$result)) {
return false;
exit();
} else {
ftp_chdir($connection, $path); // go to destination dir
if(ftp_mkdir($connection,$newDir)) { // create directory
return $newDir;
} else {
return false;
}
ftp_close($conn_id); // close connection
}
}
?>
credit to Han Van den Hoof