The correct answer is: the gravatar directory needs to be writable by the web server. This can be accomplished in several ways.
The quick-and-dirty solution is to chmod 777 gravatars
. This gives read/write/execute permissions to everyone. Depending on the details of your hosting environment, this may be bad.
For example, on a shared host, permsission mode 777 means that any user with shell access can delete all your gravatars. Big whoop? Well, they could also replace all your gravatars with whatever picture they want.
You could assign ownership of the gravatars directory to the user that the web server uses (usually www-data
, or nobody
, or maybe something else): chown www-data gravatars
. Then assign only that user permission to write to the gravatars directory: chmod 755 gravatars
. That would work fine most of the time, since my plugin offers web-based controls for deleting cached gravatars.
Another option would be to assign group ownership of the gravatars directory to the group account used by the webserver (usually www-data
or nogroup
or nobody
or maybe something else): chgrp www-data gravatars
. Then assign this group the permission to read and write to the gravatars directory: chmod 765 gravatars
.
Personally, I like all the files in my webspace to be owned by me; so I use the last option. It ensures that my user account can always do whatever needs to be done to the files but also allows the webserver to do what little it needs to do.