Forum Moderators: coopster

Message Too Old, No Replies

Setting permissions

         

Nutter

9:37 pm on May 14, 2006 (gmt 0)

10+ Year Member



I'm working on the installation script for an application I'm running and have come upon a problem. I need to be able to determine permissions of certain files and folders and would like to change them to the correct permissions if they are not right. But the chmod() and chown() functions only seem to work if the file owner is nobody, but the files were uploaded using FTP so they're listed under my ftp account as owner.

Any suggestions? I'm sure this has been done before but I can't find any tips.

eelixduppy

9:50 pm on May 14, 2006 (gmt 0)



Will ftp_chmod [us2.php.net] work?

eelix

Nutter

9:58 pm on May 14, 2006 (gmt 0)

10+ Year Member



That seems like a step I don't want to have to take, mostly because it would require inputing the ftp username / password into the setup routine which is something I'm not willing to require. Cool idea though. I haven't ever looked in to the PHP FTP functions.

I've thought of having a shell script that would be part of the package and then run through exec(), but I don't think that would work either as it wouldn't have the correct permissions to do what needs to be done. Although I think Menalto Gallery does something like this - maybe I should look at how they handle it.

The biggest issue is one folder that is empty as it sits in the package. Everything in that folder is uploaded by the user after the package is installed. Maybe my best bet is to create that folder as part of the installation script using mkdir() and then I should have the correct permissions to make it writable.

The other two permissions I ran in to were both file permissions of the upload, so maybe that should be taken care of through FTP by the user, dunno.

Nutter

10:51 pm on May 14, 2006 (gmt 0)

10+ Year Member



Well that worked :-)

I added a page to the installation script that checks permissions of all the places that it needs to be able to write and won't continue 'til it's fixed.

Thanks for letting me write out my ideas. It's amazing how much that helps.

eelixduppy

10:54 pm on May 14, 2006 (gmt 0)



>>>Thanks for letting me write out my ideas. It's amazing how much that helps.

I've had a couple experiences like that myself :)

eelix