Writing files on Linux
| From: | Corin Rathbone | Date: | Fri, 10 Aug 2001 20:12:49 +0000 |
| Subject: | Writing files on Linux | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-62209@lists.php.net to get a copy of this message | ||
Does anybody know why the function below does not work on Linux yet works
perfectly well on windows.
function write_file($file, $contents){ // $contents is like "Test, Test"
global $root_path; // $root_path is /var/www/htdocs
$file_location = $root_path.$file; // $file is /jim.txt
$fp = fopen("$file_location", "w") or die("Could not open file
pointer.");
$worked = fwrite($fp, $contents) or die("Could not write to file pinter");
// It fails here
fclose($fp) or die("Could not close file pointer");
return $worked;
}
It always fails at fwrite.
Thanks,
Corin Rathbone