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 Starting the Project

PHP code not running

Hi,

I'm doing the Build a Simple PHP App course. I downloaded xampp, and I'm at the point where I'm trying to display "Shirts for Mike" in the tab using php tags,

ex: <title><?php echo "Shirts 4 Mike"; ?><title>

while also showing the current year with the copyright.

ex: <p>Ā©<?php echo date ('Y'); ?> Shirts 4 Mike</p>

I've tried to display the page by clicking on the index file, but the code doesn't execute. Then I tried calling it with the localhost url, but that didn't display anything.

I am using Win 8 and the latest version of Chrome.

As always, I appreciate any help that's offered. Thanks.

I forgot to mention that I am running the Apache server program from the xampp folder.

3 Answers

Tong Vang
Tong Vang
9,926 Points

Start the Apache program first. Then open a brower. Type localhost/file name in the web address. Make sure the file is located in the htdocs folder. Apache only reads from that folder. Make sure the file is not in a subfolder. If it is you have to add the folder name to the address. It goes localhost/folder/filename.php.

I also forgot to mention that the index is saved with the proper php extension.

I did have it in a subfolder. I can't believe I didn't think of that.

Thank you!