Why isn't this working? (php)

I’m trying to write to a simple txt file using flash and php. After several failed attempts I decided to brake the code down to it’s bare minimum and build up from there, unfortunately even that didn’t work.

Here’s my php code.

<?php

$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "Testing
";
fwrite($fh, $stringData);
fclose($fh);


?>  

the file it’s writing to (testFile.txt) has it’s access set to 777 as does the php file. I point my browser to the php file but nothing gets written to the text file. I know the server is allowing php (at least on some level) because my php mail is working perfectly.

Can anyone figure out the problem? Is there an error in the php? Is it possible my host may have some feature disabled?