ubuntu-users@lists.ubuntu.com
[Top] [All Lists]

Re: Shouldn't a file I create default to being owned by me?

Subject: Re: Shouldn't a file I create default to being owned by me?
From: Zach
Date: Fri, 17 Feb 2006 07:22:54 -0500
I the problem that you can open the file locally in firefox but when
you access it through apache, it won't work?

I see two possiblities here, either or both of which may be a problem.
 The file appears to be owned by you.  Also the read & write bits are
set as well, at least for you.  However the user that apache runs as
must also be able to access the file.  Since apache doesn't run as
"dave," and probably isn't in the "dave" group, the file might need
read permissions for other.  May as well set read for group as well:
-rw-r--r--
The other thing is that since this is a php file, it is a script.  I
thought it may need the execute bit set in order to execute.  However
i checked some of the php files on my system and they aren't set
executable, so that may not be the case.  It could be that the apache
php module interprets the script internally without requiring
filesystem level execute permissions.

Ordinarily files served up by apache probably would be under some
special directory like /var/www or something.  all the files that get
served would be owned by apache's group, if not the apache user:
-rw-r-----  1 dave www 20 2006-02-13 22:45 /var/www/phpinfo.php

I have a simlink to /var/www in my home directory, because I'm lazy. 
I like to edit the files in my home then just copy them one directory
down.


On 2/17/06, Dave M G <martin@xxxxxxxxxxxxx> wrote:
> Ubuntu Users,
>
>     I have Appache, PHP, and MySQL all set up and running smoothly. I
> also have three different web sites that I keep in my localhost
> directory and view from within FireFox, without any problems.
>
>     So, I was suprised when I created a little PHP script to test
> something, and when I viewed it through FireFox, it said there was a
> "permissions error".
>
>     At first I thought this must be a PHP problem, because I create and
> view files within my localhost directory all the time. But the people on
> the PHP mailing list were sure it was just a file permissions problem.
>
>     Sure enough, I looked at the file properties from a command prompt,
> and the default was not to be read or written to:
> -rw-------  1 dave dave 20 2006-02-13 22:45 /home/dave/web_sites/phpinfo.php
>
>     So I changed the properties with chmod 777 and the file opens fine.
>
>     Now I'm confused by this. Why would this file, which I created and
> saved using gedit, automatically have its permissions set up so I can't
> view or edit it? Why does no other file that I have made or edited
> behaved like this? Is this a one time problem, or is there a fundamental
> problem I'm missing?
>
>     Any advice would be much appreciated.
>
> --
> Dave M G
>
> --
> ubuntu-users mailing list
> ubuntu-users@xxxxxxxxxxxxxxxx
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>


--
If you reply to a message I posted to a mailing list,
and you want me to see your reply, be sure to put my
address in the 'To:', or I might not see the message.

--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

<Prev in Thread] Current Thread [Next in Thread>