apaceh 模块 vhost_alias_module 设置好后,$_SERVER['DOCUMENT_ROOT']不跟虚拟主机路径一样
apaceh 模块 vhost_alias_module 设置好后,$_SERVER['DOCUMENT_ROOT']不跟虚拟主机路径一样,输出的结果是‘/apache/htdocs’,求解怎样才能让$_SERVER['DOCUMENT_ROOT'] 跟着虚拟主机的路径
PHP。INI 配置如下:
UseCanonicalName Off
NameVirtualHost 192.168.2.81:80
<VirtualHost 192.168.2.81:80>
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon
VirtualDocumentRoot D:/webhtdocs/%2+
</VirtualHost>
[解决办法]
httpd.conf中找到DocumentRoot
你应该设置这个参数,如DocumentRoot "d:/mydir"
之后重启apache即可