Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Build a Simple PHP Application Creating the Menu and Footer Including the Header

How come my browser isn't reading php files?

Please help, I downloaded MAMP, and the 'index.php' only works if it is an html file. Why is this happening? Please help!

5 Answers

Travis Thompson
Travis Thompson
12,976 Points

Once you have MAMP turned on you can locate the folder the files are in by typing in http://localhost:8888/MAMP/htdocs in your browser. If that does not work just trying typing on http://localhost/MAMP/. If neither of these work and you have MAMP turned on I would suggest that you just start over. Watch the video on installing PHP on a mac, and follow it step-by-step. It's the best video I've ever seen for getting started with MAMP. Very clear and easy to follow.

Patrik Balogh
Patrik Balogh
47,986 Points

Put <?php ?> tags around your PHP code. ;D)

Thanks for the suggestion but i already did that.

Travis Thompson
Travis Thompson
12,976 Points

Is your index.php placed inside of MAMP's htdocs folder?

Yes, it is. I'm using Brackets and Google Chrome on a Mac if that helps.

Travis Thompson
Travis Thompson
12,976 Points

Hmm maybe it is best to revisit how to install php video on mac. My only other two guesses is that you simply don't have MAMP turned on, or that you are not typing in localhost in your browser and then locating the php file you want to open in the browser.

Link to the video: http://teamtreehouse.com/library/build-a-simple-php-application/getting-started-with-php/install-php-on-mac-os-x

Hope that helps!

how do you do the localhost thing?