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!

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 PHP Basics (Retired) What is PHP? Intro to Workspaces and PHP Code

My web browser does not interpret my .php document in the right way. It just spits out the code in chrome.

When I open my .php file in Chrome it simply shows the code that I've written. Do I need some kind of extension so that my browser interprets the code correctly?

Help would be helpful.

1 Answer

Seth Reece
Seth Reece
32,867 Points

You need to use apache2 server to open php files as a web page. Once you have that set up, your files go in the apache root folder. For Ubuntu the default is var/www/html. Then you go to http://localhost/ or

Is there any videos on how to do this on treehouse? I have followed multiple installation guides attempting to make it so I can develop and preview websites with PHP, but I haven't been able to get anything working. I could use a more comprehensive walkthrough on how to access the apache root folder and use a text editor to preview php files.