use $ENV{SCRIPT_FILENAME} instead of $ENV{DOCUMENT_ROOT} to referer to different htdocs directories
$ENV{DOCUMENT_ROOT} could not match the real htdocs directory of portal or manager.
This should be replace by an extraction of the directory of $ENV{SCRIPT_FILENAME} instead.