htaccess pcfg_openfile: unable to check htaccess f

2020-02-09 06:23发布

Today i migrated my images from one server to another and faced a strange permission issue

[Mon Mar 25 08:42:23.676315 2013] [core:crit] [pid 15182] (13)Permission denied: [client 24.14.2.22:48113] AH00529: /files/domain.com/public_html/images/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/files/domain.com/public_html/images/' is executable, referer: http://domain.com.com/file.php

what i've tried:

    chmod -R 777 root_dir
    restorecon -r
    disable selinux
    Chown -R root:root root_dir

6条回答
做自己的国王
2楼-- · 2020-02-09 06:53

I had the same problem. For me, it's a problem of SeLinux (CentOS 7).

It works for me:

$ setsebool -P httpd_enable_homedirs true
$ chcon -R -t httpd_sys_content_t /var/www/html/

Note that you should change the above /var/www/html/ to an appropriate directory.

查看更多
Fickle 薄情
3楼-- · 2020-02-09 06:59

Today I faced this problem. I transferred public_html from the old drive to new one and chown like this:

chown -R owner:owner public_html

This is correct for sub directories and files inside public_html, but the user of public_html must be nobody so apache can check it's content, so this solved my problem:

chown owner:nobody public_html

Note: owner is the user (for example web1)

查看更多
疯言疯语
4楼-- · 2020-02-09 07:05

open your httpd.conf file and change Deny from all to Allow from all on the .htaccess file

The following lines prevent .htaccess and .htpasswd files from being

viewed by Web clients.

<FileMatch "^\.ht">
  Order allow,dey
  Allow from all
</FileMatch>

this solved my problem

查看更多
淡お忘
5楼-- · 2020-02-09 07:12

TL;DR:

sudo chmod a+rx /var{,/services{,/web{,/web-folder}}};
find /var/services/web/web-folder -type d -exec sudo chmod a+rx {} +;

You need to make certain that the directory, and all of its parent directories, are readable and executable (executability is required to open a directory) by the web server. You can do this by making the web server user the owner and making the user perms (EG: chown apache <dir>; chmod u+rx <dir>;), or by a making the group be the web server group a group which includes the web server user and setting the group perms to (EG: chgrp apache <dir>; chmod g+rx <dir>;), or by setting the world perms to (EG: chmod o+rx <dir>;).

查看更多
我想做一个坏孩纸
6楼-- · 2020-02-09 07:14

I was using Plesk onyx and I got the same error message, I just changed the folder permission to 775 and it worked for me.

查看更多
孤傲高冷的网名
7楼-- · 2020-02-09 07:16

When I checked httpd/user-error_log, it gave

[Fri Jan 09 18:58:08 2015] [crit] [client 192.168.1.xxx] (13)Permission
denied: /var/services/web/web-folder/.htaccess pcfg_openfile: unable to check
htaccess file, ensure it is readable

chmod 755 is not fixing the problem. Below command is what works for me. I use http since it is the apache user and group used in Synology DSM 5.1-5021

  cd /var/services/web
  chown http:http web-folder


 apache httpd.conf @ /etc/httpd/conf/httpd.conf

more details about the new change Apache / Webserver limitations in 5.0

查看更多
登录 后发表回答