php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8156 fopen() fails
Submitted: 2000-12-07 09:24 UTC Modified: 2000-12-21 03:18 UTC
From: paul_tanner at alum dot mit dot edu Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.0.3pl1 OS: RedHat Linux 6.2
Private report: No CVE-ID: None
 [2000-12-07 09:24 UTC] paul_tanner at alum dot mit dot edu
You may be able to shed some light on this PHP problem.

Have not used the facility to write files before so apologies if this is a simple config issue.

Anything that tries to write to a file fails.

I checked that the target directory is writable by the Apache user (nobody).  This is set to 777.

Here's a test prog:

<html><body>
<h2>file write test</h2>
<?
  $out=fopen("/home/handyman/DB/tmp.tmp","w") || die ("Can't open file for write");
  fputs($out,"test string\n");
  fclose($out);
?>
</body></html>

Here's the result.

file write test

Warning: Supplied argument is not a valid File-Handle resource in /home/handyman/public_html/traveller/test.php on line 7

Warning: Supplied argument is not a valid File-Handle resource in /home/handyman/public_html/traveller/test.php on line 8

Note:  It did not fail the fopen()  it did, however, fail the write and the close.  It creates a file of zero length.

The file handle did not get created properly.  But why?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-07 19:38 UTC] jason@php.net
Can you include your configure line,
also can you print the output of $out after the fopen?

-Jason
 [2000-12-21 03:18 UTC] jason@php.net
No responce.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC