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 Getting Started with PHP Your First PHP File

My localhost is not showing anything

I type exactly the same thing. But my browser does not show anything, it was just blank. Somebody can help me?

9 Answers

Stone Preston
Stone Preston
42,016 Points

it looks like you have an incorrect php tag. you need to use <?php as the open tag not <? php

try using this code:

<!DOCTYPE html>
<html>
<head>
    <title>Shirts 4 Mike</title>
</head>
<body>
    <h1>Shirts 4 Mike</hi>
    <p>&copy;<?php echo date('Y'); ?> Shirts 4 Mike </p>
</body>
</html>

then save the file and try again

Yes

Stone Preston
Stone Preston
42,016 Points

can you post the filename and the extension, the directory your file is in, the address you are visiting in the browser, and the code from your file please

How to post?

Stone Preston
Stone Preston
42,016 Points

just type the name of your file, the directory your file is in, and the address you are visiting in a comment. and copy and past your code in as well

test.php is my file name. It is in my htdocs inside the MAMP file in application. http://localhost/test.php.

Code is here: <!DOCTYPE html> <html> <head> <title>Shirts 4 Mike</title> </head> <body> <h1>Shirts 4 Mike</hi> <p>Ā©<? php echo date('Y'); ?> Shirts 4 Mike </p> </body> </html>

<!DOCTYPE html>
<html>
<head>
    <title>Shirts 4 Mike</title>
</head>
<body>
    <h1>Shirts 4 Mike</hi>
    <p>&copy;<? php echo date('Y'); ?> Shirts 4 Mike </p>
</body>
</html>

Why is my code not showing up here? It isn't the right code. :( Sorry, I'm not sure why? but it delete of the html head and other elements.

Stone Preston
Stone Preston
42,016 Points

you have to format code in the forum to make it show up. see this forum post for how to do that. I formatted your code for you so it should show up now

Thank you so much!!! Argh I'm so dumb. Sorry to trouble you. Should we be friends or something like that? haha :)

Stone Preston
Stone Preston
42,016 Points

haha no worries. dont feel bad, stuff like that happens all the time.

Haha Thanks A lot. This forum is great!!! I don't have to wait for long time. Once again, Thank you so much!!! Thanks for the help!!! I will try to be more careful in the future :D!!! Thanks!!!