Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
    
What's the error you are getting in the php log files? (Possibly just the standard apache error.log) –  Zypher Feb 9 '11 at 5: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 9 '11 at 8:03

2 Answers 2

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.

share|improve this answer

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

echo 0 >/selinux/enforce

and repeat the test.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.