I am having probs with fputs on my remote server. The files and directories are set to 777. When I do a fputs there are no errors but the file remains empty. Here is a simple script I have tried to debug the problem
<?php
error_reporting (E_ALL);

$filename = "text2.php";

$fd = fopen( "$filename", "w+" );
echo "file resource = $fd<br>"; // returns resource o.k
$filemessage = "2222223333 test message";
fputs($fd, $filemessage);
fclose( $fd );

$f_a = file($filename);
print_r ($f_a); // empty ?

?>

    And it works on your local server? It should work on both, I don't see a problem. Try printing something other than a variable (fputs($fp,"hello")) and see if that writes.

      Thanks for your reply. The problem has now been solved, I was working for a client who's php chat script wasnt working. Turns out the problem was that he had exceeded his storage quota for his hosting and that was disallowing the writing of any more data

        Hehe, I didn't think there was a problem with the code, but you never know what you can do with different setups. Glad you figured it out.

          Write a Reply...