rondog Posted January 4, 2011 Share Posted January 4, 2011 I am trying to create a folder using amfphp using this method: <?php function createProject($dir) { $query = mysql_query("SELECT * FROM projects WHERE proj_path = '$dir'"); $num = mysql_num_rows($query); if ($num > 0) { return "folder already exists"; } else { $root = $_SERVER['DOCUMENT_ROOT']; $theDir = $root . $this->dataFolder . "/" . $dir; //return $theDir; -> "/home/content/c/s/8/cs8xo/html/xxxxxxx/project_data/testfolder2" return mkdir($theDir,0755); } } ?> I've commented out what $theDir returns when I pass it a $dir. $this->dataFolder == "/xxxxxxx/project_data" When I return the mkdir(), I get this error: (Object)#0 message = "faultCode:AMFPHP_RUNTIME_ERROR faultString:'mkdir(): No such file or directory' faultDetail:'/home/content/c/s/8/cs8xo/html/xxxxxxx/amfphp/services/clientlogin2/Projects.php on line 147'" name = "Error" rootCause = (null) Line 147 is referring to the mkdir() line. Can anyone spot anything obvious that I could be missing? Link to comment https://forums.phpfreaks.com/topic/223401-i-have-an-issue-using-mkdir/ Share on other sites More sharing options...
BlueSkyIS Posted January 4, 2011 Share Posted January 4, 2011 echo $theDir to see what it looks like. Link to comment https://forums.phpfreaks.com/topic/223401-i-have-an-issue-using-mkdir/#findComment-1154802 Share on other sites More sharing options...
rondog Posted January 4, 2011 Author Share Posted January 4, 2011 echo $theDir to see what it looks like. I did I have it commented out in the method up top /home/content/c/s/8/cs8xo/html/xxxxxxx/project_data/testfolder2 Link to comment https://forums.phpfreaks.com/topic/223401-i-have-an-issue-using-mkdir/#findComment-1154812 Share on other sites More sharing options...
jcbones Posted January 4, 2011 Share Posted January 4, 2011 Make sure `project_data` exists, and is spelled correctly. Link to comment https://forums.phpfreaks.com/topic/223401-i-have-an-issue-using-mkdir/#findComment-1154936 Share on other sites More sharing options...
rondog Posted January 4, 2011 Author Share Posted January 4, 2011 Make sure `project_data` exists, and is spelled correctly. It is there and spelled correctly. It also has 755 permissions. I tried changing it to 777, but that didn't help. Link to comment https://forums.phpfreaks.com/topic/223401-i-have-an-issue-using-mkdir/#findComment-1154944 Share on other sites More sharing options...
jcbones Posted January 4, 2011 Share Posted January 4, 2011 Will the code make the test directory in `xxxxxxx`? Which is the directory above `project_data`? Link to comment https://forums.phpfreaks.com/topic/223401-i-have-an-issue-using-mkdir/#findComment-1154948 Share on other sites More sharing options...
rondog Posted January 4, 2011 Author Share Posted January 4, 2011 ok I tried making it in the root directory like so (not quite the xxxxxx directory yet): <?php function createProject($dir) { $query = mysql_query("SELECT * FROM projects WHERE proj_path = '$dir'"); $num = mysql_num_rows($query); if ($num > 0) { return "folder already exists"; } else { $root = $_SERVER['DOCUMENT_ROOT']; $theDir = $root . $this->dataFolder . "/" . $dir; return mkdir($root . "/" . $dir,0755); } } ?> It returned true, yet I do not see it in the root. When I try and make it again it says file exists. This code works on my other server, I am guessing their is a weird config on this server going on Link to comment https://forums.phpfreaks.com/topic/223401-i-have-an-issue-using-mkdir/#findComment-1154952 Share on other sites More sharing options...
rondog Posted January 4, 2011 Author Share Posted January 4, 2011 I figured it out... the domain is a subdomain so $_SERVER['DOCUMENT_ROOT'] wasn't accurate. I had to include the document root + the subdomain folder. It is now working. Thanks for helping me. Link to comment https://forums.phpfreaks.com/topic/223401-i-have-an-issue-using-mkdir/#findComment-1154958 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.