I am on an unmanaged Dedicated server and here is the problem. I have a folder named "uploads" where images are stored. I have coded a PHP script that stores the files here. PHP is able to write to this directory only with "777" permission. File writing does not work with 755 or 775 permission on this server. I know allowing "777" invites security issues. So how to allow PHP write files with "755" permission. I have SSH access and can modify the apache/php configuration files if required.
I wouldn't worry about changing the file permissions. You need to change the owner that the directory belongs to. I'm pretty sure it should be whatever the owner name on your server is for apache, but I could be wrong. If you change it appropriately then you will be able to leave it at 755 and still allow your script to write to the directory.
Pretty sure he's looking to be able to upload images from the website itself. Possibly an image hosting site?
maybe when you upload change the permission to 777 then after the upload process change it back to 755.. you can use the chmod function for this one..
Not sure if that would work. Usually executing a chmod command won't allow the user to give permissions that they themselves don't have. In this case, if the permissions are 755 and he is not the file owner then he will not be able to change the permissions to 777.
Well its a custom site wherein our site members can upload avatar for their Profile Page. We store avatars submitted by the Members in "uploads" folder. Looks like I need to change the owner for that particular directory as suggested by the other member here. Will need to find out how to do this.