xmapp配置虚拟目录的时候报错


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/";




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值