提问者:小点点

无法在Xampp中检查htaccess文件


我用的是Codeigniter3。0.4,现在改为使用mac电脑和Xampp服务器,但我发现以下错误。

[Tue Mar 01 22:31:29.108763 2016][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/”可执行


共1个答案

匿名用户

首先,您应该确定XAMPP作为什么用户运行。然后,您应该通过在终端上运行以下命令来了解该用户属于哪些组:

groups <username>

其中

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

# 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)。