note 51253 deleted from function.fwrite by nlopess
| From: | nlopess@php.net | Date: | Fri, 25 Mar 2005 14:14:08 +0000 |
| Subject: | note 51253 deleted from function.fwrite by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-86977@lists.php.net to get a copy of this message | ||
Note Submitter: Will at EnigmaChannel dot com
Reason: useless
----
(Very important information that would have saved me hours of stress...)
The file you want to write to should be in the same folder as the php page that has your script:-
Using fopen('tester.txt', 'w',1); to write to the file 'tester.txt' in
your include folder, doesn't appear to work on my Mac OS X Server.
Also using fopen('tester.txt', 'a',1); does not create the file, it returns an
error.
You must set the file permissions for the file you wish to write to. Create the file first then on
the Mac you right-click or Apple-click the file (tester.txt) and do Get Info. Then set the
Permissions to Read+Write.
This code will then work:-
$file = fopen('tester.txt', 'w');
fwrite($file, 'string to write');
fclose($file);