How to fix file permissions readiness check issues in Magento 2
When file permissions are not set properly, the system displays an error message. Below, we describe the issue and propose several resolutions. For more useful tips, follow this link: Magento 2 Developer’s Cookbook
Table of contents
The issue
When permissions are not set properly, the Web Setup Wizard displays a message similar to the following one:
1 2 |
File Permission Check 1 file permission not met |
It usually happens when directories in the Magento file system are not writable by the web server user; if applicable, the Magento file system owner should also have these permissions.
The solution
The way how you fix file permissions readiness check issues in Magento 2 depends on the following conditions:
- One user setup: the same user logs in to the Magento server and runs the web server (shared hosting environments);
- Two users setup: one user logs in to the Magento server, another one runs the web server (private hosting or own server).
One-user setup
Keep up with the following prerequisites:
- Magento is installed in /var/www/html/magento2
- You have command-line access
Next, enter the following command:
1 |
cd /var/www/html/magento2 && find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} + && find var vendor pub/static pub/media app/etc -type d -exec chmod g+w {} + && chmod u+x bin/magento |
Two-user setup
If there is no command-line access, you can use an FTP client or a file manager app to set permissions.
Keep up with the following prerequisites:
- Magento is installed in /var/www/html/magento2
- The web server group name is apache
Next, enter the following command:
1 |
cd /var/www/html/magento2 && find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} + && find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} + && chown -R :apache . && chmod u+x bin/magento |
If you cannot change permissions as a Magento file system owner, enter the following command as a user with root privileges:
1 |
cd /var/www/html/magento2 && sudo find var vendor pub/static pub/media app/etc -type f -exec |
For further information, read this article: