0

I am currently running Apache and PHP on Ubuntu. I have a page where a user is supposed to upload a profile image. The action on the backend is supposed to work like this:

  1. Upload file to user directory -- WORKS!

  2. Refer to the uploaded file and create a thumbnail in directory thumbs -- DOES NOT WORK

www-data has write access to directory thumbs. My guess is that www-data for some reason does not have proper access to the file that was uploaded.

UPLOADED FILE PERMISSIONS

-rw-r--r-- 1 www-data www-data 47057 Feb  8 23:24 0181c6e0973eb19cb0d98521a6fe1d9e71cd6daa.jpg

THUMBS DIRECTORY PERMISSIONS

drwxr-sr-x 2 www-data www-data  4096 Feb  8 23:23 thumbs

Im at lost here. I'm new to Ubuntu as well. Any help would be greatly appreciated!

SOLVED:

I was using a function imagecreatefromjpeg() and needed to add run the following:

apt-get install php5-gd

So it turned out not to be a permissions issue.

Thanks for the suggestion and I am sure they will come in handy in the near future!

DWLabs
  • 1
  • 2
  • What's the error you are getting in the php log files? (Possibly just the standard apache error.log) – Zypher Feb 09 '11 at 05:00
  • Please post the error and also let us know how the file is being uploaded. Is the place where the file is being uploaded in the docroot? – d-_-b Feb 09 '11 at 08:03

2 Answers2

0

It seems to be like a permission problem. If so, you can do the following to confirm.

Change the destination folder to /tmp/. This is world-writable folder. It the thumbs creation succeeded. Then, it is likely that www-data is not able to write to thumbs folder. Another check is to change the folder you are reading from. You can also read from /tmp/. It if works, then your www-data user is having troubles accessing the folders.

Khaled
  • 36,533
  • 8
  • 72
  • 99
0

Sounds like a possible candidate for selinux stepping on your feet. Try

echo 0 >/selinux/enforce

and repeat the test.

MadHatter
  • 79,770
  • 20
  • 184
  • 232