phpnow:open_basedir restriction in effect;file is not within the allowed path的解决办法

phpnow: 出现类似 open_basedir restriction in effect;file(。。)is not within the allowed path。。
下边还会有至少2行的Warning和Fatal error;

解决的方法有两个:
①:运行PnCp.cmd,选择0 -vhs 添加 虚拟主机 
程序会列出现有的虚拟主机列表,在最下面输入要添加的虚拟主机的域名(也就是IIS下所谓的“主机头”) 
输入主机别名(也就是将多个域名绑定到主机上,多个域名之间一定是要用空格隔开) 
指定网站目录(也就是网站程序文件所在的文件夹) 
[ 如果分配此主机给其他用户, 并限制其权限, 请输入 "y";否则, 请输入 "n". 默认 Y ]
-> 限制虚拟主机权限? (Y/n):这里请一定要输入“n”,不限制权限,否则将会出现前面所说的“open_basedir restriction in effect”的错误! 

②可以在apache的conf\extra下的httpd-vhosts.conf文件对要添加的虚拟主机进行修改,如下:
<VirtualHost *>
      <Directory "D:/test/Site">
          Options -Indexes FollowSymLinks
          Allow from all
          AllowOverride All
      </Directory>
      ServerAdmin admin@dev.ystore
      DocumentRoot "D:/test/Site"
      ServerName dev.test.info:80
      ServerAlias *.dev.test.info
      ErrorLog logs/dev.test.info-error_log
      php_admin_value open_basedir "D:\test;C:\WINDOWS\Temp;"###这一句是关键,如果你require的文件是D:\test下的init.php,由于init.php不在Directory设置的目录下,故而会报错。将open_basedir 的路径设置成D:\test就好了。
</VirtualHost>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值