|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-01-07 12:11 UTC] tony2001@php.net
[2006-01-15 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 23 10:00:01 2025 UTC |
Description: ------------ I am trying to look for a file, if exisit it should open it for reading and writing, if not it should create one for me. The code works fine on "PHP Version 4.3.4" but does not work with "PHP Version 5.0.4". I have set the folder and file permission to 777 as its a counter file. Reproduce code: --------------- <?php $filename = "/homepages/domain/demo1/counter/auction_id.txt"; $somecontent = "1"; // Let's make sure the file exists and is writable first. if (is_writable($filename)) { if (!$handle = fopen($filename, 'w+')) { echo "Cannot open file ($filename)"; exit; } if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success, wrote ($somecontent) to file ($filename)"; fclose($handle); } else { echo "The file $filename is not writable"; } ?> Expected result: ---------------- If file exists it should open and add 1, if not it should create a new file and add 1. Actual result: -------------- Cannot open file (/homepages/autorepodepot/demo1/counter/auction_id.txt)