Mkdir - creating new directory error

I was trying to make a new directory named “100”:

$myID = 100;
mkdir("/".$myID."", 0777);

But I was reciving this error:
mkdir() [function.mkdir]: Permission denied

So I went to the FTP Client and set the premission to my file to 777
And now I get

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@*** and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

How can I make it work?

EDIT
For some reason now I managed to made it work…

if (!is_dir("../".$myID))
		mkdir("../".$myID, 0777);
	$mainfile="../".$myID."/index.php";
	if (file_exists($mainfile)) 
		unlink($mainfile);
		
	if (!$handle = fopen($mainfile, "w+"))
	{
		echo "Cannot open file name ". $mainfile;
		exit;
	}
	
	fwrite($handle, $somecontent);

but when I try to access the directory im getting this error;


Forbidden

You don't have permission to access /53/ on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.