wutske 0 Report post Posted May 4, 2007 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: 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. <?phpif (chmod(thumbnails, 0777)) echo 'good';else echo 'bad'; if (chown(thumbnails, 'wutske')) echo 'super';else echo 'terrible';?> and this is the error I getWarning: chown() [function.chown]: Operation not permitted in /home/wutske/public_html/PHP/albums/Ik/chmod.php on line 7Conclusion, 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). 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 ? Share this post Link to post Share on other sites
yordan 10 Report post Posted May 4, 2007 (edited) Are you talking about your Xisto account or talking about your schools's computer ?If you are talking about your Xisto 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 !RegardsYordan Edited May 4, 2007 by yordan (see edit history) Share this post Link to post Share on other sites
wutske 0 Report post Posted May 6, 2007 I'm talking about my Xisto 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 Xisto). 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 ... Share this post Link to post Share on other sites
develCuy 0 Report post Posted May 7, 2007 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 B)Blessings! Share this post Link to post Share on other sites