Re: fopen problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, June 23, 2005 4:33 pm, Ross said:
> Warning: fopen(counterlog.txt) [function.fopen]: failed to open stream:
> Permission denied in c:\Inetpub\wwwroot\pillars\index.php on line 30

The PHP user does *NOT* have permission to open the counterlog.txt file.

Exactly *HOW* you change permissions changed in every Windoze version,
which suck, but there it is.

You should A) post *which* Windows OS you are using and B) try the Windows
list and C) poke around with Windows Explorer first to see if you can't
make the counterlog.txt file be owned by the User PHP is running as, which
you can find out from http://php.net/phpinfo

Actually, do ABC) in reverse order :-)

> Warning: fwrite(): supplied argument is not a valid stream resource in
> c:\Inetpub\wwwroot\pillars\index.php on line 33
>
> Warning: fclose(): supplied argument is not a valid stream resource in
> c:\Inetpub\wwwroot\pillars\index.php on line 36

These are a direct result of the first error.

Your script should NOT have even *TRIED* to run these functions, once it
failed to open the file in the first place.

Add a lot more error-checking to your script.

Once you "fix" the first error, these errors will "go away"

In Reality, they are just waiting to re-surface when something else goes
wrong with your file access.

So, actually, fix your script to skip these lines *FIRST* then fix the
error above.  Consider it part of the learning to write Good Code.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux