Re: Weird permission issue

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

 



On Wed, May 8, 2019 at 2:01 PM Cliff Nieuwenhuis
<c.nieuwenhuis@xxxxxxxxxxxxxx> wrote:
>
>
> -----Original Message-----
> From: Larry Martell [mailto:larry@xxxxxxxxxxxxxxxxxxxxx]
> Sent: Wednesday, May 8, 2019 12:55 PM
> To: Willie M <matthews.willie80@xxxxxxxxx>
> Cc: PHP General <php-general@xxxxxxxxxxxxx>
> Subject: Re: Weird permission issue
>
> On Wed, May 8, 2019 at 1:39 AM Willie M <matthews.willie80@xxxxxxxxx> wrote:
> >
> > On 5/7/19 12:51 PM, Larry Martell wrote:
> > > On Tue, May 7, 2019 at 3:41 PM Willie M <matthews.willie80@xxxxxxxxx> wrote:
> > >> On 5/7/19 12:33 PM, Larry Martell wrote:
> > >>> I have a PHP app and it runs from /var/www/html/foo. It writes to
> > >>> a log file in there log.txt. To do some testing I created a dir
> > >>> /var/www/html/foo.new and installed the code there. To switch back
> > >>> and forth I do this:
> > >>>
> > >>> mv  /var/www/html/foo  /var/www/html/foo.old mv
> > >>> /var/www/html/foo.new /var/www/html/foo
> > >>>
> > >>> When I do that I get an error writing to the log file:
> > >>>
> > >>> Error #2: fopen(/var/www/html/foo/log.txt): failed to open stream:
> > >>> Permission denied
> > >>>
> > >>> But if I switch back:
> > >>>
> > >>> mv  /var/www/html/foo  /var/www/html/foo.new mv
> > >>> /var/www/html/foo.old /var/www/html/foo
> > >>>
> > >>> I do not get the error. The code is identical in foo and foo.new
> > >>> and the perms and owner on log.txt is identical in too and
> > >>> foo.new. I have tried restating apache and rebooting the machine, but no joy.
> > >>>
> > >>> What could be causing the permission error?
> > >> Who owns the foo.new and the foo.old directories? That is most
> > >> likely where the problem is.
> > > Both are owned by root.root with mode 755. I tried chmod-ing foo.old
> > > to 777 but still get the error.
> >
> > If I am not mistaken 755 is rwxr-xr-x by root if it is owned by root.
> > The php files are ran by www or whoever it runs for on your computer.
> > So it isn't going to be a writeable file at all in that folder if the
> > file isn't made yet and if it is made in the folder you have to make
> > sure whoever runs php can write to the file.
> >
> > You have to check on all this. I am sure it is permissions.
>
> > Yes, as I said in my pervious message I tried chown-ing all the dirs to 777 but I still get the error.
>
> What about SELinux security settings?

Damn! That is it. I should have known that. Thanks. I once worked for
someone who had a poster in their office that said "It's always
SELinux"

Now trying to figure out how to get around this without disabling SELinux.



[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