In preparation for my move to a production server later, I'm using this code (php) to make a new directory that will store a user's files:
function createNewUserFolder($newUserName)
{
$siteRoot = "http://" . $_SERVER['HTTP_HOST'] . "/myWebsite/";
$newUserSubfolder = $siteRoot . $newUserName;
if (!mkdir($newUserSubfolder, 0755))
{
echo "PROBLEM...";
}
}
I've tried 0644 permissions to no avail -- I only get 'PROBLEM...' when this executes. I check the string containing the full path and it's correct - "http://localhost/myWebsite/myNewUserSubfolder".
So I'm suspecting the "http://localhost/myWebsite/" part of the above string is the problem. Yet I don't see why -- after all, this is php code running on my web server, so why can't my php code create a folder on my web server?
for windows environments you may want to do something like this
$siteRoot = "c:\\path\\to\\siteroot\\myWebsite/";
$newUserSubfolder = $siteRoot . $newUserName;
if (!mkdir($newUserSubfolder, 0755))
{
echo "PROBLEM...";
}
Try that
Or try using FTP if there is FTP support on your server read more here http://php.net/manual/en/book.ftp.php