php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31059 cannot write to files
Submitted: 2004-12-10 23:22 UTC Modified: 2004-12-11 00:38 UTC
From: gagarin at i-dep dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.9 OS: linux fedora core 3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gagarin at i-dep dot com
New email:
PHP Version: OS:

 

 [2004-12-10 23:22 UTC] gagarin at i-dep dot com
Description:
------------
I cannot open files for writing with fopen. fileperms function on existing file returns FALSE.


i checked file permissions, turned safe mode off to no avail. the same script runs on machines with  FC1 and php 4.3.8 just fine.

fopen for reading works fine.

I can read/write the same files with perl cgi scrips but not with php 






Reproduce code:
---------------
my test script

<?php
$filename = '/var/www/html/test.txt';
$content = "Add this to the file\n";


if (file_write($filename,$content)) echo "Success";

   function file_write($filename, &$content) {

     if (!$fp = @fopen($filename, "w")) {
           echo "Cannot open file ($filename)";
           exit;
       }
       if (fwrite($fp, $content) === FALSE) {
           echo "Cannot write to file ($filename)";
           exit;
       }
       if (!fclose($fp)) {
           echo "Cannot close file ($filename)";
           exit;
       }

    return true;
   }

?>


Expected result:
----------------
Success

Actual result:
--------------
Cannot open file (/var/www/html/test.txt)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-11 00:38 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Sep 22 09:01:23 2020 UTC