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

Leonard Morrison
PLUS
Leonard Morrison
Courses Plus Student 32,914 Points

Practicing my PHP skills on my website.

I'm trying to update my website with some PHP so that I don't have to maintain it, but when I converted my files from .html to .php, all the php code does not seem to register. Thank you in advance.

<!DOCTYPE html>
<?php
$en_name = "Leban Mohamed";
$jp_name = "リバンモハメド";
?>
<html>
    <head>
        <meta charset="utf-8">
        <title><?php echo $en_name;?> | Programmer</title>
        <link rel="stylesheet" href="css/normalize.css">
        <link rel="stylesheet" href="css/main.css">
        <link rel="stylesheet" href="css/responsive.css">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

    </head>
    <body>
        <header>
            <a href="en-index.html" id=logo>
                <h1><?php echo $en_name; ?></h1>
                <h2>Programmer and Developer Extrodinaire </h2>


            </a>
          <nav>
            <ul id="menu-setup">
                <li><a href="en-about.html">About</a></li>
                <li><a href="en-index.html" class="selected">Portfolio</a></li>
                <li><a href="en-contact.html">Contact</a></li>
            </ul>
            <!-- closing nav tag was here -->


            <ul id="nav2">
                <li><a href="en-index.html">英語/English</a></li>
                <li><a href="jp-index.html">日本語/Japanese</a></li>
            </ul>
          </nav> <!-- move closing nav tag here -->
        </header>
        <div id="wrapper">
        <section>
            <img class="friends" src ="Pictures/friends-anon.jpeg">
            <ul id="gallery">
            <p>Here's where the gallery will be</p>
                <li>
                            <a href="Pictures/Watton.png">
                            <img src="Pictures/Watton.png" alt="">
                            <p>This app is a project I worked on when I was in college. It's a modified stopwatch used for relay races.</p>
                        </a>
                </li>

                <li>
                        <a href="Pictures/NintendoFunFacts.png">
                            <img src="Pictures/NintendoFunFacts.png" alt="">
                            <p>Another simple app I've created for fun. I figured I'd throw a Nintendo themed factoid this time.</p>
                        </a>
                </li>
            </ul>
        </section>


        <footer>
        <a href ="https://www.facebook.com/leban.mohamed"><img src="Pictures/facebook-wrap.png" alt="Facebook logo"></a>
        <a href ="https://twitter.com/realLebanM"><img src="Pictures/twitter-wrap.png" alt="Facebook logo"></a>

            <p>&copy; <?php echo date("Y") . $en_name;?></p>
        </footer>
    </div>

    </body>
</html>

Are you talking about when you actually look at the website the php code doesn't work? If that's the case, there's a possibility that you don't have a server setup for the files to run on.

If you already have a website online through a hosting company, you may need to look and see if you need to install a server that supports php. Although it's very rare to find a server now-day's that doesn't have support for php on them. I am by far no expert at all, but if you haven't tried any of those I would try them, and if you can't get them to work for you, somebody else will help you, i'm sure!

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

There's a number of options out there for installing a local server so you can run PHP without taking out web hosting.

Desktop Server is one and I use XAMPP for windows. :-)