not able to create directory using mkdir
<p>When a customer logs in, I want to create all the folders under his id. I am doing it like this:</p>

<pre><code>&lt;?php
include('connect.php');

$aid = $_SESSION['application_id'];

$sql = "select * from ApplicationRegister where application_id= $aid" ;
echo $sql;
$result = mysql_query($sql) or die (mysql_error());
while ($row = mysql_fetch_assoc($result))
{
  echo "&lt;table width='65%' cellpadding='4' border='0'&gt;";

  echo "&lt;tr&gt;&lt;td&gt; &lt;h4&gt; Company Name:   &lt;/h4&gt;&lt;/td&gt; &lt;td&gt;" . $row['CompanyName'] . "&lt;/td&gt; &lt;/tr&gt; ";

  echo "&lt;tr&gt;&lt;td&gt; &lt;h4&gt; Company E-mail:   &lt;/h4&gt;&lt;/td&gt; &lt;td&gt;" . $row['CompanyEmail'] . "&lt;/td&gt; &lt;/tr&gt;";

  echo "&lt;tr&gt;&lt;td&gt; &lt;h4&gt; Registration Type:   &lt;/h4&gt; &lt;/td&gt; &lt;td&gt;". $row['RegistrationType'] . "&lt;/td&gt;&lt;/tr&gt;";

  echo "&lt;tr&gt;&lt;td&gt; &lt;h4&gt; Plan:   &lt;/h4&gt; &lt;/td&gt; &lt;td&gt;" . $row['ApplicationPlan'] . "&lt;/td&gt;&lt;/tr&gt;";

  echo "&lt;tr&gt;&lt;td&gt; &lt;h4&gt; Registered Date:   &lt;/h4&gt; &lt;/td&gt;&lt;td&gt;" . $row['Createddate'] . "&lt;/td&gt;&lt;/tr&gt;";

  echo "&lt;/table&gt;";
}

$file = $_SERVER['DOCUMENT_ROOT']; 
echo $file;

mkdir("$file/opencart/images/$application_id/products/");
mkdir("$file/localhost/opencart/images/$application_id/category/");
mkdir("$file/localhost/opencart/$application_id/application/");

echo "directory created";
?&gt;
</code></pre>

<p>I even checked the folder permissions. Its all read and write, but folders are not getting created. Please help me figure out how to do it.</p>
