CyberiaPC.com Community Forums Main Page
RSS Feeds: Late(st) News | Zenith Picture Gallery | Most Recent Community Topics | Tips, Tricks and Other Useful Stuff

Welcome Guest ( Log In | Register )

 Forum Rules Also hosted on SourceForge and FreshMeat
Reply to this topicStart new topic
> [Zenith 0.85] problem with chmod, uploads .....
CharlyG
post Nov 28 2005, 07:10 PM
Post #1


Active Member
Group Icon

Group: +Zenith User
Posts: 127
Joined: 1-December 04
From: Metz, France
Member No.: 2,051

France




Hello Ali

I have a new problem.
when a new image is added, it is recorded with a chmod of 600 instead of 644.

I am not certain, but I think that that arrives since the update in v0.8.5

I looked in script add.php and the file config.php :
CODE
$config['chmod_pics'] = "0644";


on the other hand in the file admincp.php, one finds this line of code:
CODE
<tr><td align='left' class='white_cell' width='60%'>{$lang['chmod_pics']}</td><td align='right' class='white_cell' width='40%'><input value='{$config['chmod_pics']}' type='text' name='chmod_pics' maxlength='4' class='textBox' style='width:100%' READONLY></td></tr>


why you wrote READONLY ?

Can you help me?

This post has been edited by CharlyG: Nov 28 2005, 07:13 PM
Go to the top of the page
 
+Quote Post
usr.c
post Nov 28 2005, 11:41 PM
Post #2


Boss, my code's compiling (xkcd)
Group Icon

Group: Admins
Posts: 10,440
Joined: 19-September 01
Member No.: 1

Nothing Selected




Hi,

It hasn't been changed in v0.8.5. I suspect the problem to be caused by the server. Has Apache been recompiled or upgraded recently?

See this: http://cyberiapc.com/forums/index.php?show...indpost&p=37525

Let me know what happens.


--------------------


Things that I don't suck at: Photography (flickr, JPG Mag), Skydiving, Splitting atoms, Flying a space shuttle
"Don't bail; the best gold is at the bottom of barrels of crap!" -Randy Pausch
I have people-skills goddamnit! What is wrong with you people!!! | www.skyrill.com
Go to the top of the page
 
+Quote Post
CharlyG
post Nov 29 2005, 01:13 PM
Post #3


Active Member
Group Icon

Group: +Zenith User
Posts: 127
Joined: 1-December 04
From: Metz, France
Member No.: 2,051

France




I do not have any control on the server.
the engineering department said to me that the images are into 600 per defect.
Go to the top of the page
 
+Quote Post
usr.c
post Nov 29 2005, 02:36 PM
Post #4


Boss, my code's compiling (xkcd)
Group Icon

Group: Admins
Posts: 10,440
Joined: 19-September 01
Member No.: 1

Nothing Selected




hmm...I disagree with them.

To be honest, I can't remember why it was set to readonly in the first place. Nevertheless, the default value is 0644 and that's what all uploaded pictures are chmodded to. Have a look in image_man.php for example. Each method has the line (occurs 3 times)

CODE
if(!@chmod($path_server, 0644))


which sets the permission on the uploaded file to be world readable and owner writeable.

Actually, that line should probably read

CODE
if(!@chmod($path_server, 0644) || !@chmod($path_thumbnail, 0644))


to chmod both the file and its thumbnail to 0644. But because Apache should normally be set up to set the permission of files to 0644, that line is in there as an assurance.

One thing I'd suggest you try is remove the @ in the line above (before the 'chmod') so that the script displays any errors that it encounters while chmodding.

Let me know what happens.


--------------------


Things that I don't suck at: Photography (flickr, JPG Mag), Skydiving, Splitting atoms, Flying a space shuttle
"Don't bail; the best gold is at the bottom of barrels of crap!" -Randy Pausch
I have people-skills goddamnit! What is wrong with you people!!! | www.skyrill.com
Go to the top of the page
 
+Quote Post
CharlyG
post Nov 29 2005, 04:55 PM
Post #5


Active Member
Group Icon

Group: +Zenith User
Posts: 127
Joined: 1-December 04
From: Metz, France
Member No.: 2,051

France




Actually, in image_man.php :

CODE
//chmod original file to 0777 temporarily, then return to 0644
 if(!@chmod($path_server,0777))
           if($config['debug_mode'] == 1)   echo "Cannot change the mode of file ($path_server)";

 @ImageDestroy($image); //free memory
 if (!@ImageJPEG($thumbnail, $path_thumb, $quality)) { // try to save thumbnail image
     $msg .= $lang['image_man_check'];
 }
 if(!@chmod($path_server, 0644))
           if($config['debug_mode'] == 1)   echo "Cannot change the mode of file ($path_server)";
     
 return $msg;


3 times (jpg, pgn, gif)
Go to the top of the page
 
+Quote Post
usr.c
post Nov 29 2005, 05:27 PM
Post #6


Boss, my code's compiling (xkcd)
Group Icon

Group: Admins
Posts: 10,440
Joined: 19-September 01
Member No.: 1

Nothing Selected




You can do it for both or just for the second line, which says:

CODE
if(!@chmod($path_server, 0644))


--------------------


Things that I don't suck at: Photography (flickr, JPG Mag), Skydiving, Splitting atoms, Flying a space shuttle
"Don't bail; the best gold is at the bottom of barrels of crap!" -Randy Pausch
I have people-skills goddamnit! What is wrong with you people!!! | www.skyrill.com
Go to the top of the page
 
+Quote Post
CharlyG
post Nov 29 2005, 10:42 PM
Post #7


Active Member
Group Icon

Group: +Zenith User
Posts: 127
Joined: 1-December 04
From: Metz, France
Member No.: 2,051

France




I do not have any error message or other...

when do we use the functions present in the file image_man.php?
Go to the top of the page
 
+Quote Post
usr.c
post Nov 29 2005, 10:58 PM
Post #8


Boss, my code's compiling (xkcd)
Group Icon

Group: Admins
Posts: 10,440
Joined: 19-September 01
Member No.: 1

Nothing Selected




decider(...) is called in add.php once a file passes all the validation.

I'll have a look at it from my end as well, though I still think it's server-related.


--------------------


Things that I don't suck at: Photography (flickr, JPG Mag), Skydiving, Splitting atoms, Flying a space shuttle
"Don't bail; the best gold is at the bottom of barrels of crap!" -Randy Pausch
I have people-skills goddamnit! What is wrong with you people!!! | www.skyrill.com
Go to the top of the page
 
+Quote Post
CharlyG
post Dec 24 2005, 02:15 PM
Post #9


Active Member
Group Icon

Group: +Zenith User
Posts: 127
Joined: 1-December 04
From: Metz, France
Member No.: 2,051

France




Ali I don't understand ...
I made the update of scripts.
But problems persists ! sad.gif

The images still do not have the good chmod when one adds them on the site.

here is phpinfo :

http://www.e-midge.com/info.php

This post has been edited by CharlyG: Dec 24 2005, 02:23 PM
Go to the top of the page
 
+Quote Post
usr.c
post Dec 24 2005, 05:26 PM
Post #10


Boss, my code's compiling (xkcd)
Group Icon

Group: Admins
Posts: 10,440
Joined: 19-September 01
Member No.: 1

Nothing Selected




OK, not to worry CharlyG. We'll get to the bottom of this. Let's try and figure it out one step at a time.

First, could you please do the following via FTP:

1. Change to your uploads directory and choose a directory, but don't click it.

a. What are its permissions?
b. What user and group does it belong to?

2. Switch to your chosen directory and choose a picture that's currently not showing up (e.g. pn4-1024.jpg). If the picture is in a sub-directory, please refer to (1).

a. What are its permissions?
b. What user and group does it belong to?

3. Find that particular picture's thumbnail.

a. What are its permissions?
b. What user and group does it belong to?


--------------------


Things that I don't suck at: Photography (flickr, JPG Mag), Skydiving, Splitting atoms, Flying a space shuttle
"Don't bail; the best gold is at the bottom of barrels of crap!" -Randy Pausch
I have people-skills goddamnit! What is wrong with you people!!! | www.skyrill.com
Go to the top of the page
 
+Quote Post
CharlyG
post Dec 25 2005, 05:06 PM
Post #11


Active Member
Group Icon

Group: +Zenith User
Posts: 127
Joined: 1-December 04
From: Metz, France
Member No.: 2,051

France




QUOTE(usr.c @ Dec 24 2005, 06:26 PM)
OK, not to worry CharlyG.  We'll get to the bottom of this.  Let's try and figure it out one step at a time.

First, could you please do the following via FTP:

1. Change to your uploads directory and choose a directory, but don't click it.

a. What are its permissions?
b. What user and group does it belong to?

2. Switch to your chosen directory and choose a picture that's currently not showing up (e.g. pn4-1024.jpg).  If the picture is in a sub-directory, please refer to (1).

a. What are its permissions?
b. What user and group does it belong to?

3. Find that particular picture's thumbnail.

a. What are its permissions?
b. What user and group does it belong to?
*


1.
a.



b. all user

2.
a.

b. all user

3. I have no thumbnails because:

QUOTE
Allow the creation of thumbnails : No


I do not allow the creation of the thumbnails for a question of place about the server.
I point out that we have more than 13 300 pictures on the site.

This post has been edited by CharlyG: Dec 25 2005, 05:10 PM
Go to the top of the page
 
+Quote Post
usr.c
post Dec 25 2005, 07:18 PM
Post #12


Boss, my code's compiling (xkcd)
Group Icon

Group: Admins
Posts: 10,440
Joined: 19-September 01
Member No.: 1

Nothing Selected




1. Thanks, but I also need to know the user and group of those directories and images. See the attached image. In SmartFTP, right-clicking a file reveals that information.

I've noticed that your host is running PHP as a CGI script as opposed to an Apache module. Unfortuantely, I don't know anything about the former, but perhaps it's stricter when it comes to who can set file permissions.

2. Please upload the attached PHP file to your main Zenith directory, run it, then post the results here. I believe the path to the sample picture is correct, but change it if it's not.
Attached thumbnail(s)
Attached Image
 

Attached File(s)
Attached File  charlyg_dec2505_1.php ( 831bytes ) Number of downloads: 33
 


--------------------


Things that I don't suck at: Photography (flickr, JPG Mag), Skydiving, Splitting atoms, Flying a space shuttle
"Don't bail; the best gold is at the bottom of barrels of crap!" -Randy Pausch
I have people-skills goddamnit! What is wrong with you people!!! | www.skyrill.com
Go to the top of the page
 
+Quote Post
CharlyG
post Dec 25 2005, 11:31 PM
Post #13


Active Member
Group Icon

Group: +Zenith User
Posts: 127
Joined: 1-December 04
From: Metz, France
Member No.: 2,051

France




QUOTE(usr.c @ Dec 25 2005, 08:18 PM)
1. Thanks, but I also need to know the user and group of those directories and images.  See the attached image.  In SmartFTP, right-clicking a file reveals that information.

I've noticed that your host is running PHP as a CGI script as opposed to an Apache module.  Unfortuantely, I don't know anything about the former,  but perhaps it's stricter when it comes to who can set file permissions.

2. Please upload the attached PHP file to your main Zenith directory, run it, then post the results here.  I believe the path to the sample picture is correct, but change it if it's not.
*


1.
folder :


Files :


2.

QUOTE
Attempting to chmod
[ removed ]/www/zenith/uploads/- Films et Comedies musicales -/pn4-1024.jpg

0600: 1
0644: 1
0755: 1
0777: 1


and pn4-1024.jpg is now 777

This post has been edited by usr.c: Dec 26 2005, 12:13 AM
Go to the top of the page
 
+Quote Post
usr.c
post Dec 26 2005, 12:06 AM
Post #14


Boss, my code's compiling (xkcd)
Group Icon

Group: Admins
Posts: 10,440
Joined: 19-September 01
Member No.: 1

Nothing Selected




That's good. I think this will solve your problem:

In add.php, look for (line 156)

CODE
if(@move_uploaded_file($_FILES['upload']['tmp_name'], $final_upload_location_server.$filename)) {


Add the following after it

CODE
//chmod original file in case the server's default isn't world readable
if(!@chmod($final_upload_location_server.$filename, 0644))
    if($config['debug_mode'] == 1)   echo "Cannot change the mode of file ($path_server)";


--------------------


Things that I don't suck at: Photography (flickr, JPG Mag), Skydiving, Splitting atoms, Flying a space shuttle
"Don't bail; the best gold is at the bottom of barrels of crap!" -Randy Pausch
I have people-skills goddamnit! What is wrong with you people!!! | www.skyrill.com
Go to the top of the page
 
+Quote Post
CharlyG
post Dec 26 2005, 02:27 PM
Post #15


Active Member
Group Icon

Group: +Zenith User
Posts: 127
Joined: 1-December 04
From: Metz, France
Member No.: 2,051

France




thank you
that works fine !!!!
wink.gif
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 25th May 2013 - 10:51 PM