$fn=$_SERVER['DOCUMENT_ROOT']."/".$_SERVER['REQUEST_URI']; if (file_exist($fn)) { // output } else { // create }