Question
imagemagick can't overwrite files on Ubuntu 16.04
I’m overlooking something to do with permissions for imagemagick. I set up a new Ubuntu 16.04 droplet exactly as per the DO guide, giving my new user root privileges etc. Ditto for the LAMP stack, exactly per the DO guide and everything ran well.
I install imagemagick. It works fine, I can do various commands with it, it’s resizing and saving images I upload, until…
It won’t overwrite any of the existing images it had previously saved. It throws:
object(ImagickException)#2 (7) { ["message":protected]=> string(105) "unable to open image `/var/www/public_html/images/abcd.jpg': Permission denied @ error/blob.c/OpenBlob/2712"
This is running fine on with the same code on my local LAMP development server, so I’m pretty sure it’s a permissions issue (as well as it stating so in the error). What I don’t understand is that I can write to the folder ok, just not overwrite? All images, their folders and parents have 755 permissions. I’m a bit lost.
I have nothing else unusual going on in terms of users. PHP executing a userinfo request on the page states the user is www-data.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×