Writing file to php (perms correct) does not work!!! Help!

Hi All,

Well I have a strange problem that has me stumped for ages.

Here is my problem.

I have a directory called test chmod'ed to 777 and in it i have a file called test.php and test.txt which is also chmod'ed to 777

The test.php file simply contains:

PHP Code:
<?php
$filename 
'test.txt';
$somecontent "Add this to the file\n";

if (!
$handle fopen($filename'a')) {
         echo 
"Cannot open file ($filename)";
         exit;
   }

   
// Write $somecontent to our opened file.
   
if (fwrite($handle$somecontent) === FALSE) {
       echo 
"Cannot write to file ($filename)";
       exit;
   }

   echo 
"Success, wrote ($somecontent) to file ($filename)";

   
fclose($handle);

?>
Well that should write the "Add this to the file" to the file but it does not....

Does anyone have any idea why it will not write to the file? I have checked the logs and everything!

 

 

 

 

Top