|
|
|
|
![]() ![]() |
May 4 2007, 12:41 PM
Post
#1
|
|
|
Way Out Of Control - You need a life :) Group: [HOSTED] Posts: 1,087 Joined: 2-August 05 From: Kapellen (Antwerp, Belgium) Member No.: 7,585 |
We have to make something in PHP for school, so I decided to make a complete photoalbum. One of the things that it can is creating and storing thumbnails, but here is where the problems start. The thumbnails have to be stored in a subfolder called 'thumbnails', if this folder doesn't exist, my script creates this folder and everything works like it is supposed to be.
But it doesn't do that the way I want. The folder is made with: CODE mkdir($thumbnail_folder, 0777); but when I check it via FTP, it is set to 755. Even worse is that I can't access or remove this folder because the user and group are set to 99 instead of wutske. If I chmod it afterwards to 0777 with this script. The chmod works fine, but the chown doesn't. CODE <?php if (chmod(thumbnails, 0777)) echo 'good'; else echo 'bad'; if (chown(thumbnails, 'wutske')) echo 'super'; else echo 'terrible'; ?> and this is the error I get QUOTE Warning: chown() [function.chown]: Operation not permitted in /home/wutske/public_html/PHP/albums/Ik/chmod.php on line 7 Conclusion, as wutske, I have problems to get to 99 . But, I have the same problem in the opposite direction, I can't chmod of chown a folder that I made via FTP (user + group = wutske). QUOTE Warning: chmod() [function.chmod]: Operation not permitted in /home/wutske/public_html/PHP/albums/chmod.php on line 2 My question is, how can I make PHP chmod folders that I made and how can I let PHP make folders that I can access ? I know it's possible because Gallery can (I just checked it, username=wutske and group=99). Ps. group=99 , wich group is this ? |
|
|
|
May 4 2007, 05:19 PM
Post
#2
|
|
|
Way Out Of Control - You need a life :) Group: [MODERATOR] Posts: 2,240 Joined: 16-August 05 Member No.: 7,896 myCENTs:7.01 |
Are you talking about your astahost account or talking about your schools's computer ?
If you are talking about your astahost account, do you have a ssh access to your account ? Then you can start verifying things. If we are talking about your schools account, first of all try to access your folders when connected through ssh or telnet. You will see funny things with chmod. Simply create some Unix scripts creating directories, creating files ("touch myfolder/myfile" will create a file) and chmodding the files. I guess that the guy who is really creating the folders is the owner of the php binary files, so, his account is probably 99. So, this guy cannot chmod in folders he does not own, unless these folders have been chmodded previously. Moreover, probably the php program cannot change the files and directories permissions in a less severe way than allowed by wutske umask (probably 022). I think that all the things your gallery users will do, will be made by php, so you probably should think in terms of the php program permissions, and not in terms of wutske user permissions. Hope that I am right... If so, hope this helped ! Regards Yordan This post has been edited by yordan: May 4 2007, 05:21 PM |
|
|
|
May 6 2007, 06:18 PM
Post
#3
|
|
|
Way Out Of Control - You need a life :) Group: [HOSTED] Posts: 1,087 Joined: 2-August 05 From: Kapellen (Antwerp, Belgium) Member No.: 7,585 |
I'm talking about my astahost account.
I'd like to be able to upload new albums using an upload script or through FTP (FTP is faster because I can't use ZIP function on astahost). I'm going to change my scripts so they won't try to chmod anymore but just echo that the user should chmod the folder ... |
|
|
|
May 7 2007, 01:37 AM
Post
#4
|
|
|
Member - Active Contributor Group: Members Posts: 88 Joined: 5-April 07 From: Cusco - Peru Member No.: 21,283 |
Hi wutske!
If you get 777 then don't worry be happy!!! Remember that the web server runs under a unix user privileges, this means that the folders/files created with PHP will have the same: privileges, user and group as the web server user. In *nix, you can't change the ownership of a folder/file if you are not superuser: root or have enought privileges. Anyway, your script have to create a folder for thumbnails and you only need 777, forget about chown!!! BUT!!!! If sometime, for any reason, you need to create files with your user as owner. Then create a cronjob to run the PHP script, the task will run with CGI and under your user. But this is not useful for your gallery Blessings! |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 4th December 2008 - 06:06 AM |