PHP file is the source code of PHP language, a server-side scripting language.
PHP is currently one of the most common server-side scripting languages. It is very popular for developing web based software applications because programmers can use it easily to create web pages with dynamic content that interact with databases. The PHP source code is written by web developer and is processed on the web server, which dynamically generates HTML. The HTML, which contains the web page content, is then sent to the user's web browser. Therefore, the user should never see the actual PHP source code but only the web page.
PHP file is the source code of PHP language which contains text, HTML tags, and scripts. It is returned to the browser as plain HTML. Besides, PHP files always have filename extensions of .php, .php4, or .php5
When you download a file with php file name extension, it is the fault of the webmaster. There are three possible situations, you can try one by one trying to open the PHP file you downloaded.
Case 1: It is an HTML document generated by PHP
That means it is a webpage file. You can rename it to a .html file extension and open it in a web browser.
Case 2: It is an PHP source code file
You can open it using Notepad/Wordpad or any other text editor programs.
Case 3: It is an PDF/JPG/... document generated by PHP
Similar to case one, it is generated by PHP in the server. But it is not the webpage, it is a different type of file (such as a PDF, executable or graphic) - rename it so the file extension matches the type you were expecting.