Jump to content

I have an issue using mkdir()


rondog

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.