Hallo,
I am trying to write a string to a text file but I cannot connect to the file with the 'w' mode.
It seems like 'r' mode only is accepted but I cannot find how to write/create new content to the file.
I am using PHP 4.2.2, Apache 2, on a Linux server.
The code I am trying is:
$file = '/server_path/file.txt';
if(!$fd = fopen($file, "w")) {
echo 'unable to open file'; //this is what I get
exit;
}
if(fwrite($fd, $string) === FALSE) {
echo 'unable to write to file';
exit;
} else {
echo 'I wrote '.$fout.' chars.';
}
fclose($fd);
Could anybody help ?
Thank you !