I am trying to properly display an error document using a PHP function virtual() to users with a “not found” page if a condition is met. This is what I wrote on the script:
// if condition is met
virtual('/var/www/error/HTTP_NOT_FOUND.html.var');
Somehow, a blank page is shown and this is the warning I received:
PHP Warning: virtual(): Unable to include
‘/var/www/error/HTTP_NOT_FOUND.html.var’ – request execution failed in
/var/www/html/test on line 100
I have checked that the following are being done:
-
In php.ini,
include_path = ".:/var/www/error" -
In 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 has read access to the error folder and files.
What could be causing the warning and how to solve this problem?
Try removing root folder from virtual: