How do i prevent php files from being downloaded \"illegally\" like through the browser. And what are some ways someone can use to download the php files?
You never download the php file from a web server running php. You can donwload the HTML delivered from the php like in this answer. You don't get php script you get HTML + JavaScript (if some)