jpistone Posted December 11, 2006 Share Posted December 11, 2006 Hi all....I'm at wits end with my hosting company (otherwise good) regarding uploading trouble.I'm uploading a file to a directory called "uploads" with permissions set to 0777. The upload checks to see if a directory is created within the "uploads" directory. If it isn't, it creates it: mkdir(<path>,0777) then uploads the file into it. This works fine. The problem however is once done, I can't modify or delete or upload any other files into the same directory as the permissions have been changed from 0777 to 0755. It won't let me alter these either using PHP (chmod) or an ftp client such as SmartFTP. While it sounds like an issue on the hosting company's part I'm at a loss where to go next. The error message I get are as follows:550 Rename/move failure: Permission deniedand550 Could not delete dec042006.doc: Permission deniedandSITE CHMOD 777 dec042006.doc550 Could not change perms on dec042006.doc: Bad file descriptorI'm unable to track down pertinent information here from searching the board...any pointers in the right direction would be tremendously appreciated...One more thing...I was setting this up last week and had no trouble at all doing any of the above...the problems began last Friday and I can't see any coding changes I've made in PHP that would cause it to begin.Thanks! Link to comment https://forums.phpfreaks.com/topic/30236-ftp-trouble-in-php/ Share on other sites More sharing options...
craygo Posted December 11, 2006 Share Posted December 11, 2006 If this is a linux box at the hosting company, the webuser account probably does not have permission to change folder permissions. Also alot of hosting companies do not allow chmod 777 on their boxes. I have had to use 775 and things were ok. Not sure if they revert back to a default permission if you try to make it to high. Also you may want to set the permissions on the folder recursively. Not sure which FTP client you use but when I change permissions with WS_FTP, it asks me if I want to change all files and folders under it to the same. I always say yes. If you make your uploads folder 775, any folder you create in that folder should also be 775.Ray Link to comment https://forums.phpfreaks.com/topic/30236-ftp-trouble-in-php/#findComment-139033 Share on other sites More sharing options...
jpistone Posted December 11, 2006 Author Share Posted December 11, 2006 Thanks, Craygo. If they curtailed 0777s though, wouldn't that preclude me from creating the folder and uploading the file initially? ...something I can do here...this is what's got me perplexed. BTW, What does "bad file descriptor" mean? Link to comment https://forums.phpfreaks.com/topic/30236-ftp-trouble-in-php/#findComment-139082 Share on other sites More sharing options...
craygo Posted December 11, 2006 Share Posted December 11, 2006 NO you actually do not need "World" permission to write and read files, since the web user owns the files anyway. You just really need user and group permissions to be 7. I am not sure if you know how the chmod works but each digit represents the permission for each groupthere are 3 groupsOwner group world7 7 7 means anyone and their grandmother should be able to do what they want with that file7 7 5means that just the Owner or the group can do what they like to the file and the World only has read and execute rights.Only reason you would need 777 is when someone writes a script that checks for the chmod of a file and if it is not 777 the script ends.I think bad file descripter may be that you do not own the file. If it is outside the public_html folder then the ownly account that can change the settings is the main account. The account that php uses cannot change the permissions outside the public_html folder or what ever the web root folder is.Ray Link to comment https://forums.phpfreaks.com/topic/30236-ftp-trouble-in-php/#findComment-139113 Share on other sites More sharing options...
jpistone Posted December 11, 2006 Author Share Posted December 11, 2006 Okay, Ray, it's inside the public_html folder, but now I'm wondering how the system identifies who's accessing the directory/file. This is where I think I'm messing up. When someone uses my upload.html page to browse and upload a file, how does the system know who that is for permission checks? That, from what you're saying is the 777 situation, right? How would I identify that user as a member of "group" instead(so, 775)? (As you can see, I'm new to this-- also, I still don't understand why I got away with this last week up until this Friday). Thanks for your help here. Link to comment https://forums.phpfreaks.com/topic/30236-ftp-trouble-in-php/#findComment-139120 Share on other sites More sharing options...
craygo Posted December 11, 2006 Share Posted December 11, 2006 It does not matter who goes on your page. They have nothing to do with it. Since php is server side, the WEBSERVER is the user accessing the files. So the account associated with the webserver is the one accessing the files. For example.In IIS(window) there is an account created called IUSR_[i]Computer_name[/i]. This is the account IIS user for directory permissions. Anything to do with the webserver and php, this user is the one that needs all the rights. So if I want to access a file anywhere on the Webserver that user needs permission for it.Ray Link to comment https://forums.phpfreaks.com/topic/30236-ftp-trouble-in-php/#findComment-139200 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.