Re: File lock - warning ?
| From: | Peter | Date: | Fri, 24 May 2002 21:00:32 +0000 |
| Subject: | Re: File lock - warning ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-99154@lists.php.net to get a copy of this message | ||
I'm not familiar with PHP 3 stuff but try
echo "start";
$fpLog = fopen
("/usr/home/aurica/aurica.com/cannesEmail/emailblastSendLog.txt","a");
if (!$fpLOG) {
die ("Could not open file");
}
if (flock ($fpLog, 2) ) {
$strFileLog = "Manisha Test";
fwrite($fpLog,$strFileLog);
}
flock ($fpLog, 3);
fclose ($fpLog);
echo "close ok ";
This would check the file has opened OK and a failure at this stage would
probably cause your error.
Can't think of anything else - sorry!
"Manisha" <manisha@aurica.com> wrote in message
news:4.3.2.7.2.20020524170618.00ab31c0@192.168.1.116...
> I open a file in append mode, I locked it and write the data.
> But when I try to unlock or close it then I get warning
>
> Warning: Unable to find file identifier 12 in www/htdocs/testfclose.php3
on
> line 9
>
> Warning: Unable to find file identifier 12 in www/htdocs/testfclose.php3
> on line 10
> close ok
>
> I am using PHP3 - code
> ------------------------------------------------
> echo "start";
> $fpLog = fopen
> ("/usr/home/aurica/aurica.com/cannesEmail/emailblastSendLog.txt","a");
>
> if (flock ($fpLog, 2) ) {
> $strFileLog = "Manisha Test";
> $fpLog = fwrite("$fpLog",$strFileLog);
> }
> $tmp = flock ($fpLog, 3);
> fclose ($fpLog);
> echo "close ok ";
> ------------------------------------------------
>
> What's wrong ?
>
> Thanks in advance,
> Manisha