无法检查 Xampp 中的 htaccess 文件

unable to check htaccess file in Xampp

我正在使用 Codeigniter3.0.4,现在改用 mac 计算机和 Xampp 服务器但是我遇到了以下错误。

[2016 年 3 月 1 日星期二 22:31:29.108763] [core:crit] [pid 2115] (13) 权限被拒绝:[client ::1:56770] AH00529:/Applications/XAMPP/xamppfiles/htdocs/dw_php-json-js/。 htaccess pcfg_openfile: 无法检查 htaccess 文件,确保它是可读的并且'/Applications/XAMPP/xamppfiles/htdocs/dw_php-json-js/'是可执行的

首先您应该确定 XAMPP 是 运行 的用户。然后你应该在终端上通过 运行 找出该用户属于哪些组:

groups <username>

其中 <username> 是用户 XAMPP 是 运行 作为。

然后您可以检查错误消息中提到的文件的权限和所有权:

# Check owner and permissions for .htaccess file:
ls -al /Applications/XAMPP/xamppfiles/htdocs/dw_php-json-js/.htaccess
# Check owner and permissions of containing directory
ls -l /Applications/XAMPP/xamppfiles/htdocs/dw_php-json-js/

此类命令的示例输出为:

# Command: ls -l /Applications/iTunes.app/Contents
-rw-r--r--    1 root  wheel    521 16 Oct 12:48 version.plist

这告诉你所有者是 root,组是 wheel。用户具有 rw(读取和写入)访问权限,组中的任何人都具有 r(读取)访问权限,每个人都具有 r 访问权限。

为了根据您收到的错误消息确保权限正确,您需要确保 .htaccess 可被用户读取并且目录是可执行的(显示为 x rw).