#31059 [Opn->Bgs]: cannot write to files
| From: | derick@php.net | Date: | Fri, 10 Dec 2004 23:38:24 +0000 |
| Subject: | #31059 [Opn->Bgs]: cannot write to files | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-70034@lists.php.net to get a copy of this message | ||
ID: 31059
Updated by: derick@php.net
Reported By: gagarin at i-dep dot com
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: linux fedora core 3
PHP Version: 4.3.9
New Comment:
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.
.
Previous Comments:
------------------------------------------------------------------------
[2004-12-10 23:22:14] 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)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31059&edit=1