TL;DR truncate pub/static
folder.
For me, I had an older installation, which probably had some symlinks and old files which no longer exist.
The issue checkInstallationFilePermissions
is that it checks the permissions recursively. Files and folders. I had a missing symlink, and that returned false on the check if it's writable.
How to debug:
setup/src/Magento/Setup/Model/FilePermissions.php
Goto line 143 in method checkRecursiveDirectories
Add the lines var_dump($subDirectory);var_dump($subDirectory->isWritable());
Re run bin/magento setup:upgrade
now you'll see what is really wrong, and you can fix it. Personally i remove everything in pub/static
, this will be auto generated content so you should not be worried about that.
How to fix
In order to resolve the 403 Forbidden problem you have to adjust permissions for user which is used to run localhost server.
- Find your username with this command:
whoami
- Then navigate and check if you have config for this user or create if doesn’t exist:
cd /etc/apache2/user/
touch <username>.conf
Where username is an user name used to run Apache server.
- Add the following configuration (note that this is only for Yosamite):
sudo vi /etc/apache2/user/<username>.conf
Add the following content:
<Directory "/Users/<username>/Sites/">
AddLanguage en .en
LanguagePriority en fr de
ForceLanguagePriority Fallback
Options FollowSymlinks Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from localhost
Require all granted
</Directory>
- Add lines in the /etc/apache2/httpd.conf configuration file:
sudo vi /etc/apache2/httpd.conf
Check and uncomment the line:
Include /private/etc/apache2/extra/httpd-userdir.conf
- In the httpd-userdir.conf file ensure to uncomment line:
Include /private/etc/apache2/users/*.conf
- Restart Apache server
sudo /usr/sbin/httpd -k restart
Enjoy developing your Magento 2 projects.
Source From : maxpronko
Best Answer
Step 1 : open the terminal and navigate to magento web root
Step 2 : Deploy command
Step 3 : Reindex command
Step 4 : Set owner command
Step 5 : Give permission command
Step 6 : Remove cache command