local PHP file is downloading instead of opening in browser

17,829

That's because php is unlike html a server based programming language, it cannot be run on the computer without a server, and i assume you don't know what I am talking about, but here is how you should do it: -

  1. Download Xamp or Wamp from the internet: - here is a link for you:- http://xampp.en.softonic.com/
  2. Follow this video in order to install it : - http://www.youtube.com/watch?v=Ev9RAsvFfoc
  3. Follow this video in order to start running php files through the installed XAMP: - http://www.youtube.com/watch?v=ImZEwrHohRg
Share:
17,829
Trippy
Author by

Trippy

Updated on July 06, 2022

Comments

  • Trippy
    Trippy almost 2 years

    First let me state that I am NOT running a web server.

    I am running on Windows 7 64-bit. When I open a php file the browser is downloading it instead of showing it as text. I am using Notepad++ to "Launch in Chrome" and it shows up in the address bar correctly but is downloading to my download directory. Just a couple of days ago this was working fine and displaying the text of the php file.

    I know you need a web server with PHP installed to get the file to render correctly but that is not what I'm trying to do. I simply want it to display the php file as text. Then I change the file:/// portion of the URL to localhost and it works.