It's because require_once
throws a fatal error when executing the script, which stops the rest of the execution. You need to use include_once
or file_exists
functions instead.
$file = 'abc';
if(file_exists($file)) {
require_once($file);
} else {
echo 'File not found';
}
It's better to have error_reporting set to on when developing. Thus setting ini_set('display_errors', true)