Permissions and EWWW IO
If EWWW IO is having trouble installing the optimization tools due to permissions, and you want to learn a thing or two, keep reading. Otherwise, just ask your web host to fix the permissions for you.
Owners
First, a word on file "ownership". On any web server, the effective permissions depend on who owns the files in question. On a dedicated server (or VPS), there is a usually a specific account that is used to run the Apache/Nginx/LiteSpeed software that serves your website. This will usually be a user like www-data, http, or httpd. On a shared hosting server, that is often delegated to your specific login/username.
In either case, the user account that runs the web server software needs to have ownership of all the files in the directory where you uploaded WordPress. If you have "root" access to the server, you can fix this yourself, otherwise talk to your web host about file ownership. Fixing ownership can be done with a command like this:
chown -R www-data:www-data /var/www/html/
The chown command is to “change ownership”. The ‘-R’ tells the server to do this recursively (include all sub-folders). The first www-data is the user account, the second one is the “group”, separated by a colon. It may not be required to specify both the user and group, but it’s best for consistency.
Permissions
As long as file ownership is set correctly on your WordPress site, then permissions are probably too restrictive. Imagine you have a box, and you want to put something inside. If the box is locked, you have to unlock the box before you put anything in the box.
With file permissions, we have 3 types of "locks": readable (r), writable (w), and executable (x). You may also see permissions represented numerically, like 755 or 644. In this notation, readable=4, writable=2, and executable=1, where 5, 6, or 7 is a combination: 5 = rx, 6= rw, 7 = rwx. When the ownership is correct, we only care about the first number, and leave the others more restrictive (5, 4 or 0). If you see 4 digits, and the first is 0, you can ignore the zero.
EWWW IO will try to install the binaries (executables) into the wp-content/ewww/ folder. In addition to needing the 'w' (writable) permission, folders must have the ‘x’ (executable) permission set in order to read or write to the files inside them. I know, that's weird, how can you execute a folder, right?
"could not create the tool folder"
Anyway, the first problem you might run into is if wp-content/ isn't "unlocked". In this screenshot, we have a wp-content folder that is set to 644 (missing the executable bit).
If you have command line access, you can set permissions with chmod:
sudo chmod -R 755 /var/www/wp-content/
The chmod is for “change mode”, mode meaning permissions. The ‘-R’ is recursive to include sub-folders.
In this case, I have access via cPanel's file manager, and can right-click on the folder to Change Permissions.
Please adjust permissions on the folder
This case is very similar to the last, so see that for more detail, but the fix is similar. Make sure the wp-content/ewww/ folder has 755 permissions:
sudo chmod -R 755 /var/www/wp-content/ewww/
could not install tools in .../wp-content/ewww/
If the plugin displays an error about installing the tools, but it says nothing about permissions, then you should contact support with your debug information (form below).
Fix All Permissions
You can fix permissions for an entire site with 2 commands:
sudo chown -R www-data:www-data /var/www/html/ sudo chmod -R ug+rwX /var/www/html/