PHP :: fopen() Server Permissions?

Okay…first time posting in the server-side forum! yee-haw…

so my question…i’m working on making a flash guestbook / blogger type program, without using an actual database (ie MySQL). I know it makes more sense to use MySQL since its probably way more versatile and organized, but i’m waiting on my buddy who runs my server to set me up with a login to access the database. Until then, I found this backwards way of dynamically creating / opening / writing to a .txt file.

In a nutshell, here is the PHP code that is causing the problem:


$openMe = 'entry.txt';
	print (chmod( dirname(__FILE__).'entry.txt', 0766 ) );
	$file = fopen($openMe, 'a+');

	if (!$file) {
		 print "&result=Fail";
		 print "&errorMsg=" . urlencode("Could not open $openMe document. Change CHMOD levels to 766.");
		 exit;
	}

I get this error when going directly to the page:


**Warning**:  chmod(): No such file or directory in **/home/httpd/html/davefelton.com/guestbook/addentry.php** on line **21**
 
 **Warning**:  fopen(entry.txt): failed to open stream: Permission denied in **/home/httpd/html/davefelton.com/guestbook/addentry.php** on line **22**
 &result=Fail&errorMsg=Could+not+open+entry.txt+document.+Change+CHMOD+levels+to+766.

I am utterly stumped here…I am pretty sure that my problem resides in those lines of code, but if you think it could lie else where, i will gladly post the entire PHP code that I am using. Any input / advice is greatly appreciated. Thanks much!

d