|
Posted by Hilarion on 11/14/05 18:43
> I am a realtive newbie to PHP, though I have been a custom application
> designer for many, many years, now moving some of my business to PHP.
>
> I am doing a little experiment: I am taking a HTML file, and updating
> it by adding some HTML text to it. I am using file_get_contents() and
> either str_replace() or preg_replace() (not sure yet of the
> difference) to do the work. that isn't the problem at the moment,
> though.
The difference is that str_replace searches for plain text (exact match),
and preg_replace uses regular expressions (Perl compatible).
> I was getting some weird errors, so I did a little experiment (right
> out of the sample code on the PHP site) to append some text to an
> ascii file using low-level functions (fopen() fwrite() etc.).
>
> I get this error:
> -------------------------------------------
> Warning: fopen(test.txt) [function.fopen]: failed to open stream:
> Permission denied in h:\Inetpub\wwwroot\KOFamily\koaddcomm.php...
> -------------------------------------------
> So it looks like I have a "rights" problem first. The system I am
> playing with is a W2K server with IIS 5.0.2195.6620. I can ortherwise
> execute PHP code without problem.
>
> Am I right that this is a "rights" problem? Would anybody please
> direct me to a resource to help me solve this?
Yes, this is probably a rights problem. Make sure that you granted
write access on this file to the IIS service account (depends on the
account you are using for this service).
The other possible reason is that you pass incorrect path to the
"fopen" function. Try with absolute path (eg.
"H:\Inetpub\wwwroot\test.txt") and if it works, then try working
out the correct relative path (it should be relative to the
executed PHP script - not the included script nor the web-root folder).
Hilarion
Navigation:
[Reply to this message]
|