fopen() and flock()
| From: | David McInnis | Date: | Sun, 01 Sep 2002 23:34:32 +0000 |
| Subject: | fopen() and flock() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-114855@lists.php.net to get a copy of this message | ||
I use fopen() in a template system that I have developed. I noticed
that occasionally I get blank pages served up. Here is one of my
snippets.
$filename = "$ROOTDIR/content/myfile.txt";
$fd = fopen ($filename, "r");
$PAGE_CONTENT = fread ($fd, filesize ($filename));
fclose ($fd);
Doing this I get the contents of the file read into the $PAGE_CONTENT
variable.
I never use fopen() to write to files. Only read with the "r"
directive. So what could be causing my conflicts? Do I need to flock
the file to shared?
I am running Linux PHP, Apache and Linux.
David McInnis