Every file and folder has permissions controlling who may read, write and run it. When something does not work, "set it to 777" is common advice on the internet. It is bad advice, and on our servers it will usually break the thing it was meant to fix.
The correct values
- Files: 644. You can read and write them; everyone else can read.
- Folders: 755. As above, plus the ability to list the contents.
- Scripts you run yourself over SSH: 700 or 755.
- Configuration files holding database passwords: 600 where the application allows it.
Why not 777
777 means anyone at all may write to it. On a shared server that is an obvious risk, but more immediately: our servers run your site as your own user, so your site already has all the access it needs at 644 and 755. Setting 777 adds nothing you need and the server will often refuse to execute the file at all, producing a 500 error. It is a common cause of the very problem people apply it to solve.
Fixing permissions in bulk
cPanel's File Manager can apply permissions recursively: select the folder, choose Permissions, and apply to files and folders separately – 644 for files, 755 for folders. Do not apply one value to both.
Files uploaded by the website
Files created by your site – uploaded images, generated caches – are owned by your account and will be correct automatically. If you have uploaded files as root over SSH, or extracted an archive created elsewhere, ownership can end up wrong; ask us and we will correct it.