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 Basic PHP Website (2018) Building a Media Library in PHP Using PHP Code on Our Site

Brian Patterson
Brian Patterson
19,588 Points

General question about php.

I have a general question about renaming the html file to php. I have been working on a single page application and wanted to know if this translates well into this project. When I click on the html file the file opens in the browser fine. When I change the extension to php the format of the site gets moved all to the left hand side. Is there anything I can do to this. Basically I feel the best way to learn is to create your own project and I am scratching my head as to example I could use.

Brian Patterson
Brian Patterson
19,588 Points

Just an aside- I added the same code into workspaces and it works. Why is work spaces different to my local machine?

3 Answers

Seth Kroger
Seth Kroger
56,413 Points

When working with PHP on your local machine you need to have PHP installed and configured to use on your web server (as well as a web server that supports PHP installed locally). PHP Workspaces do that for you automatically so you don't have to worry about it. Depending on your OS there are bundled solutions called WAMP/MAMP/LAMP (for Windows, Mac and Linux respectively) what will install Apache server, PHP, and MySQL for database.

Seth Kroger
Seth Kroger
56,413 Points

In DevTools are there any 404's when loading the page (like a misplaced CSS file)?

Brian Patterson
Brian Patterson
19,588 Points
<html>
    <head>
        <meta charset="utf-8">
        <title><?php echo "Donna Couch | Aquastars"; ?></title>
        <!-- <link rel="stylesheet" href="css/normalize.css"> -->
        <link href="https://fonts.googleapis.com/css?family=Changa+One|Open+Sans" rel="stylesheet">
        <link rel="stylesheet" href="css/style.css">

    </head>

The above is in head but the style sheet does not seem to load.