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.


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


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!


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!

  • 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

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.


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

echo 0 >/selinux/enforce

and repeat the test.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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