You are here: Re: fopen() Permission denied « PHP Programming Language « IT news, forums, messages
Re: fopen() Permission denied

Posted by Jasen Betts on 02/19/06 06:21

On 2006-02-18, Lee C Haas <Null@Address.org> wrote:
> On 17 Feb 2006 13:48:32 -0800, "Alex" <spamgrind@gmail.com> wrote:
>
>>You should allow your public_html directory to be searchable by all.
>>chmod 755 public_html.
>>...
>>Alex
>
> Thanks Alex and "samudasu," changing permissions was the key.
>
> I had to change
> lhcount.data to 766
> public_html directory to 750
>
> I don't understand why it didn't have to be 755 (which also worked)

In your case the web server may have the same group as the directory.

> and I don't understand why index.php worked with permissions 644.
> index.php has the php code in it and I would have thought it would
> need "execute" permission.
> Is this explained clearly somewhere?

php scripts don't need execute because they aren't run by name (constrast
with shell scripts) but instead they are run by invoking php to interpret
them (or using a webserver plugin etc)

> Following I is the complete php script I am using for a simple text
> counter.
>
><SPAN style="float : right; color : #999999;">
><?php
> /* The file lhcount.data with an initial number must be created in
> the same directory as the file with this script */
> $fh = fopen('lhcount.data','r+');
> $Count=fgets($fh,64);
> rewind($fh);
> fwrite ($fh, ++$Count);
> fclose ($fh);
> echo($Count);
> ?>
></SPAN>

lhcount data doesn't need owner exec permission 666 would be OK.
600 or 644 would be better if you can adjust the user-id to match that of the
webserver.

Bye.
Jasen

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация