如果满足条件,我将尝试使用php函数virtual()
向具有“未找到”页面的用户正确显示错误文档。这是我在剧本上写的:
// if condition is met
virtual('/var/www/error/HTTP_NOT_FOUND.html.var');
不知怎的,一个空白页出现了,这是我收到的警告:
php警告:virtual():无法包含
'/var/www/error/http_not_found.html.var'-请求执行失败
/var/www/html/test在线100
我已经检查了以下操作:
在php.ini中,
include_path = ".:/var/www/error"
在httpd.conf中,
<IfModule mod_negotiation.c>
<IfModule mod_include.c>
<Directory "/var/www/error">
Options +Includes
AddOutputFilter Includes html
AddHandler type-map var
Order allow,deny
Allow from all
</Directory>
ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
</IfModule>
</IfModule>
apache具有对错误文件夹和文件的读取权限。
是什么导致了警告以及如何解决这个问题?
最佳答案
尝试从虚拟中删除根文件夹:
virtual('/error/HTTP_NOT_FOUND.html.var');