Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.