Re: Write file can't work ?!? :-(
| From: | Ivan Marenic | Date: | Sun, 17 Nov 2002 21:31:06 +0000 |
| Subject: | Re: Write file can't work ?!? :-( | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124830@lists.php.net to get a copy of this message | ||
I've tried same source on different OS and it works OK.
I assume there is a BUG, for win 2000.
Thank you all for help.
Kind regards, Ivan
"Jason Sheets" <jsheets@php.net> wrote in message
news:1037563956.66814.9.camel@daemon.shadotech.biz...
Have you tried giving it an absolute path rather than a relative one?
Jason
On Sun, 2002-11-17 at 12:57, Ivan Marenic wrote:
> I've tried. It doesent work.
>
> PHP documentation for fopen function says following:
>
> Note: The mode may contain the letter 'b'. This is useful only on systems
> which differentiate between binary and text files (i.e. Windows. It's
> useless on Unix). If not needed, this will be ignored.
>
> I've tried all variations: "w", "r+", "wb" ... nothnig
> works.
>
>
>
> "Stephen" <webmaster@melchior.us> wrote in message
> news:000901c28e73$2f24a870$0200a8c0@melchior...
> > wb is not a permission. Try putting just w.
> >
> >
> > ----- Original Message -----
> > From: "Ivan Mareniæ" <imarenic@milleniumtip.com>
> > To: <php-general@lists.php.net>
> > Sent: Sunday, November 17, 2002 2:47 PM
> > Subject: [PHP] Write file can't work ?!? :-(
> >
> >
> > > Hi.
> > >
> > > I am trying to create little counter:
> > > I can't open file for writing.
> > > I've tried different params: "w", "r+", "wb" ...
> > > nothnig works
> > >
> > > I am using IIS 5.0 , and I have set permitions to read & write files
on
> > > server.
> > >
> > >
> > > ============= source code ===============
> > >
> > > if(is_writable("counter.txt")==TRUE)
> > > echo "File is writable";
> > > else
> > > echo "File is NOT writable";
> > >
> > > echo "<br>";
> > >
> > > $fd = fopen ("counter.txt", "r");
> > > $my_count=0;
> > > while (!feof ($fd)) {
> > > $my_count = fgets($fd, 4096);
> > > }
> > > fclose ($fd);
> > >
> > > $fd = fopen ("counter.txt", "wb");
> > > if($fd==TRUE)
> > > {
> > > $my_count++;
> > > fputs($fd, $my_count);
> > > fclose ($fd);
> > > }
> > >
> > > echo "Your are user no:";
> > > echo $my_count;
> > >
> > > ============= end source ================
> > >
> > > but after execution PHP says that:
> > >
> > > File is writable
> > >
> > > Warning: fopen("counter.txt", "wb") - Permission denied in
> > > c:\inetpub\wwwroot\PSK\user_no.php on line 27
> > > Your are user no:8
> > >
> > > Whay can't I open file for writing???
> > >
> > > Thanks for help!!!
> > >
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php