I am not able to write to a directory who permissions are 755 with the php script. And the only way to write to that directory is via changing the mod to 777. and i believe that is not a secure option. Do you know how can write to a directory with permission 755. Actually i am uploading the images to that.
You can try using setuid() unix call on your PHP. I think it's posix_setuid(), but I have not tried, and maybe it's not a secure action.
it had to be set to 777. minimum 666. no way you can upload to directory with 755. just make sure your script allow only image files.
you cant write because the httpd server you are using runs as user 'nobody',you have to change the directory permissions to 766( or 777) or you can disable httpd running as user nobody (dont do this )
Or .. you can change the folder permissions to be the same as httpd user. As a side note httpd running as nobody is a bit insecure afaik. I am however aquinted with Debian way of setup where apache is running as www-data user. Basic Linux tip looks like: chown httpuser.httpduser directory then chmod 755 directory (in case it wasnt done already)
okey thanks for all responses. I have changed it to 755 and made sure that nothing other then images can be uploaded to that folder. Thanks