Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Making My Album, problems with rights
wutske
post May 4 2007, 12:41 PM
Post #1


Way Out Of Control - You need a life :)
Group Icon

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 ?
Go to the top of the page
 
+Quote Post
yordan
post May 4 2007, 05:19 PM
Post #2


Way Out Of Control - You need a life :)
Group Icon

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
Go to the top of the page
 
+Quote Post
wutske
post May 6 2007, 06:18 PM
Post #3


Way Out Of Control - You need a life :)
Group Icon

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 ...
Go to the top of the page
 
+Quote Post
develCuy
post May 7 2007, 01:37 AM
Post #4


Member - Active Contributor
Group Icon

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!!! biggrin.gif
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 sad.gif

Blessings!
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Nero Problems(33)
  2. (Nearly) Ultimate Music Posting Guide(11)
  3. Flash Site Software(14)
  4. Freebsd Burning & Installation Problems(4)
  5. Making A Nice Looking Signature In Photoshop Cs(17)
  6. Rakion Problems.(2)
  7. Problems Installing Vista(14)
  8. Screensaver Problems(11)
  9. Programming In Glut (lesson 4)(7)
  10. Office 2007 Document Problems(14)
  11. Making A Turn Based Game Like Ogame(9)
  12. Php Tutorial: Making A Shoutbox(12)
  13. [php] Making Feeds Rss(3)
  14. Internet Connection Sharing Problems(2)
  15. Making Xp Starts 60% Faster(3)
  1. Updating Graphics Card Problems(11)
  2. Help With Making A Textbased Game(6)
  3. Gimp: Saving As... Issues(3)
  4. Image Problems With Windows 2000(10)
  5. Making Xp Look Like Vista(3)
  6. Wamp Server Problems(5)
  7. Making Educational Game(4)
  8. Slipknot - All Hope Is Gone(0)
  9. Problems With New Computer(10)
  10. Problems Using Usb Devices(7)
  11. Help Making A Text Based Game.(8)
  12. Email Server / Cpanel Problems(1)
  13. Making A Programming Language(6)


 



- Lo-Fi Version Time is now: 4th December 2008 - 06:06 AM