Issue getting .php file to load properly

So I’m reading the mysql/php sitepoint book and in chapter 3 I’m at the point where you make the welcome1.html and welcome1.php and upload them to the server.

When I do that I can get the .html file to open in my browser but when I click on the link (to the .php file) it tries to download the .php file instead of giving me the new page.

I noticed that the url bar has file:///application/mamp/welcome1.html instead of what it’s suppose to be, which is http://localhost/welcome1.html.

I’m on a mac using osx and using mamp.

Any reasons as to why this might be occurring?

You sir (or ma’am)… are my new hero.

Much appreciated.

Are you running the actual file? If so, you need to enter http://localhost/welcome1.html in your address bar.

When you directly open the file (i.e. by double-clicking on the “welcome1.html” file), it doesn’t run it through apache, so it can’t handle php files.