Re: Writing text to files on Windows
| From: | Rubén Gutiérrez | Date: | Thu, 21 Feb 2002 04:46:08 +0000 |
| Subject: | Re: Writing text to files on Windows | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-12169@lists.php.net to get a copy of this message | ||
On Wed, 20 Feb 2002 17:51:30 -0800
"Robert Abbate" <accounts@ispconcepts.com> wrote:
> I seem to be having trouble being able to *write* text to a file within a
> Windows server. Does anyone know what needs to be done to get this to work?
> I've tried making sure that the direcories are set to the maximum
> permissions (read/write/execute) to anyone. Still doesn't work.
>
> I'm trying this:
>
> $fp = fopen("test.txt", "w"); flock($fp, 1);
> fputs($fp, "testing");
> fclose($fp);
Try replacing this:
flock($fp, 1);
with this:
flock($fp, LOCK_EX);
or with this, if you use a PHP version prior to PHP 4.0.1:
flock($fp, 2);
Cheers,
Rubén Gutiérrez