1.启动过后,访问项目中的文件,报如下的错误:
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contactthe <a target=_blank href="mailto:fengbaolong@tuniu.com">webmaster
Error 403 <a target=_blank href="http://t.t.com/">t.t.com</a>
Apache/2.4.4 (Win64) OpenSSL/1.0.1e PHP/5.5.0
原因是xmapp路径文件夹下的 apache/conf/httpd.conf中的Directory用了默认的配置,禁止访问所有目录
<Directory />
AllowOverride none
Require all denied
</Directory>
作如下的修改即可
<Directory />
AllowOverride none
Require all granted
</Directory>
#或者是如下的配置
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
2.如果配置了虚拟目录,默认用的不是xmapp的默认项目路径
如下所示
#本地Php测试项目
<VirtualHost *:80>
ServerAdmin fengbaolong@tuniu.com
DocumentRoot "D:/workspace-all/xmapp64/test"
ServerName t.t.com
<Directory "D:/workspace-all/xmapp64/test">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
那么在访问文件的时候报下面这个错误
Warning: Unknown: open_basedir restriction in effect. File(D:\workspace-all\xmapp64\test\t.php) is not within the allowed path(s): (D:/php_server/xamppsx64/) in Unknown on line 0
Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
Fatal error: Unknown: Failed opening required 'D:/workspace-all/xmapp64/test/t.php' (include_path='.;D:/php_server/xamppsx64/htdocs') in Unknown on line 0
而这则是由于php设置了open_basedir的缘故
在php.ini中
将下面的配置注释掉即可
#open_basedir = "D:/php_server/xamppsx64/";