Question

For this problem:

  • /foo = root path

I'm receiving the following error when attempting to upload an image:

Warning: move_uploaded_file(/foo/image/upload/87ffdf995f6352db0d15ea44053ee2c7.jpg): failed to open stream: Permission denied in /foo/upload.php on line 26, referer: /foo

I checked the permissions of both /image and /upload and they are both 777

  • drwxrwxr-x 7 777 777 4096 Apr 4 12:46 /foo/image
  • drwxrwxr-x 7 777 777 4096 Apr 4 12:47 /foo/image/upload

I set these using the following command:

chmod -R 777 /foo/image

Am I missing something with permissions? I don't understand why the i'm getting this error.

Was it helpful?

Solution

It's possible that you are setting permissions for the wrong user. This has happened to me in the past, I was setting permissions for "MY_USER_NAME" when I should have been setting the permissions for "www-data" user.

The following links may be helpful to you:

http://superuser.com/questions/144984/setting-permissions-for-specific-user-and-groups-in-linux
http://www.perlfect.com/articles/chmod.shtml
http://www.linux.org/threads/file-permissions-chmod.4094/
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top