Answer the question
In order to leave comments, you need to log in
Why doesn't Apache have access to directories?
It costs Apache 2.4.23 on MacOS Sierra. Everything seemed to work fine, but at some point it stopped, although I didn’t really touch anything. The problem is the following: when accessing directories with php scripts or html files, it displays an error:
Forbidden
You don't have permission to access / on this server.
Server unable to read htaccess file, denying access to be safe
_www 9877 0,0 0,0 2480792 2040 ?? S 6:43 0:00.01 /usr/sbin/httpd -D FOREGROUND
_www 9864 0,0 0,0 2480792 1612 ?? S 6:43 0:00.00 /usr/sbin/httpd -D FOREGROUND
_www 9863 0,0 0,0 2480792 2020 ?? S 6:43 0:00.01 /usr/sbin/httpd -D FOREGROUND
_www 9862 0,0 0,0 2480792 1628 ?? S 6:43 0:00.00 /usr/sbin/httpd -D FOREGROUND
_www 222 0,0 0,0 2480792 1744 ?? S сб08 0:00.02 /usr/sbin/httpd -D FOREGROUND
root 90 0,0 0,1 2481048 7808 ?? Ss сб08 0:01.40 /usr/sbin/httpd -D FOREGROUND
alankabisov 10122 0,0 0,0 2423384 240 s000 R+ 6:58 0:00.00 grep httpd
> <Directory "/Users/alankabisov/Sites">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
<Virtualhost *:80>
VirtualDocumentRoot "/Users/alankabisov/Sites/%1/"
ServerName sites.dev
ServerAlias *.dev
UseCanonicalName Off
</Virtualhost>
[Mon Mar 13 18:45:27.113487 2017] [core:crit] [pid 9877] (13)Permission denied: [client 127.0.0.1:58513] AH00529: /Users/alankabisov/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/Users/alankabisov/' is executable, referer: http://php1.dev/
[Mon Mar 13 18:45:27.297229 2017] [core:crit] [pid 9877] (13)Permission denied: [client 127.0.0.1:58513] AH00529: /Users/alankabisov/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/Users/alankabisov/' is executable
[Mon Mar 13 18:45:27.359012 2017] [core:crit] [pid 9877] (13)Permission denied: [client 127.0.0.1:58513] AH00529: /Users/alankabisov/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/Users/alankabisov/' is executable, referer: http://php1.dev/
Answer the question
In order to leave comments, you need to log in
Apparently, Apache went through the directories to the Sites folder and looked for the htaccess file in them, and since it did not have read access to the parent directory of the Sites folder, it threw an error. I decided that I set a group for the parent folder _www and set read permissions for it. It seems to have helped. It's strange how it used to work. Well, the solution may not be the most elegant, alternatives are welcome. Until then, I'll make this a decision.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question