added check in php file to catch if subdir was undefinied