fopen and chmod 777 - but why?

cybernck

Joined: 2007-09-26
Posts: 3
Posted: Wed, 2007-09-26 12:45

The following information is required to get an answer:
Get this information from the PHP diagnostic (in the configuration wizard).
Gallery URL (optional but very useful): hidden
Gallery version: 1.5.7
Apache version: 1.3.39 (Unix)
PHP version (don't just say PHP 4, please): 5.2.4
Graphics Toolkit: ImageMagick
Operating system: CentOS 4
Web browser/version (if applicable): FF 2.0

hello,

i've recently moved from one host to another (well, to a VPS),
and while installing the latest G1 (1.5.7) and moving over all
my albums (previously created by 1.5.3, running on PHP 4.4.6)
to the new server, i come across "fopen" errors, do a search
here and find out that i have to CHMOD 777 all the folders and
files in question.

ok, i don't like it but that does the trick. however, i then go
and create some new albums which get 755 permission with files
inside having 644 by default and they work fine :-/.

so obviously 1.5.7 can work fine on my new server without 777,
but only for the new albums? i can't see a physical difference
between new and old albums, so i'm wondering what needs to be
changed (in php.ini, fs_unix.php or whatever) to make the old
albums work correctly with 755 and 644 combination.

please reply with something constructive :-).

thank you.

 
Tim_j
Tim_j's picture

Joined: 2002-08-15
Posts: 6818
Posted: Wed, 2007-09-26 12:55

Why should we answer with something thats crap?

When YOU moved the files, the files are owned by YOU.
In some cases the webserver runs as the user you are, but in some cases not.
So the webserver is not allowed to modified your files. That why you need the chmod 777.
New files are created by the WEBSERVER user and thus need only 644 / 755 for folders.

So you would need to change the owner of your files to the user that runs the webserver.
Or you need to configure your webserver to run as you.

Jens
--
Last Gallery v1 Developer.
Tryout the TEST-Version of Gallery 1.6

 
cybernck

Joined: 2007-09-26
Posts: 3
Posted: Wed, 2007-09-26 13:23

hi Tim, thanks for the speedy reply.

i just wanted to avoid replies such as "if it works - leave it"
from perhaps some less knowledgeable users. didn't know
i'd get a reply from the developer himself :).

your reply makes perfect sense. i'm a "linux virgin" and this is
my first VPS, so i'm still learning.

i'll try changing the owner and setting the permissions back to
normal and then report back.

thanks again.

 
cybernck

Joined: 2007-09-26
Posts: 3
Posted: Thu, 2007-09-27 17:32

ok, i've sorted out this issue! :-)

first i did a chmod 777 for albums folder and the files inside
and then the same for a few sub-albums, in which i was them
able to create a new album from the Gallery itself.

then i checked the owner and group of the folder that got created
by Gallery and was surprised to see it was nobody nobody! by the way,
i did try setting owner and group for all the folders and files for
the webserver user, but that did nothing.

anyway, after changing owner and group to nobody nobody for the whole
gallery folder, it now works like a charm with 755 for folders and
644 for all files (except for a couple of .sh files in gallery folder
that came as 755 by default, so i left them like that).

to do what i did, one needs shell access and this is the command one
should execute in their www, public_html or htdocs folder:

chown -R nobody.nobody galleryfolder

hopefully this will help someone with the same issue and perhaps could be
added to FAQ, for those that do have shell access and can sort it out,
rather than just leave everything as chmod 777.

thanks again Tim and keep up the good work!

 
huyeng

Joined: 2008-07-01
Posts: 1
Posted: Tue, 2008-07-01 04:38

Hello everybody,
I would like to install the Galley2.2.5. I have : Apache/2.2.2 (Unix) PHP/4.4.7
I downloaded it and uploaded to my hosting and installed it. But i can't complete it.
Because I can't upload 'log.txt' to the gallery folder. when i try to upload this file, it show the message that "permission denied".
I try to change the gallery folder from 755 to 777, but it does not work.
Does anyone help?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2008-07-01 06:54

huyeng,
I would open a new thread with your issue in the correct forum. This is for G1 and is not related to your issue.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team