|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2004-12-11 00:38 UTC] derick@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 14:00:01 2025 UTC | 
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)