php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #686 file functions not working
Submitted: 1998-08-23 01:31 UTC Modified: 1998-08-23 01:38 UTC
From: z-kimmel at uiuc dot edu Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.3 OS: NT 4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: z-kimmel at uiuc dot edu
New email:
PHP Version: OS:

 

 [1998-08-23 01:31 UTC] z-kimmel at uiuc dot edu
I want to append text to the end of a file, but I can't seem to do it.

The following code doesn't work; the file is unchanged.
--------------------------------------
$fp = fopen($filename, "rw");
$pos=fseek($fp,5);
print($pos);  # prints out 0, which is correct
$pos=ftell($fp);
print($pos);  # prints out 5, which is correct

$error = fwrite($fp, "hello"); # does nothing
$error = fclose($fp);
--------------------------------------
The following code overwrites the file completely.
--------------------------------------
$fp = fopen($filename, "w");
$error = fclose($fp);
--------------------------------------

Anyone know of a workaround?

Thanks,

--Zeba Kimmel, z-kimmel@uiuc.edu

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-08-23 01:38 UTC] rasmus
http://ca.php.net/manual/function.fopen.php3
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 19:01:36 2025 UTC