PHP Build a Basic PHP Website Building a Media Library in PHP Using PHP Code on Our Site

Brian Patterson
Brian Patterson
19,584 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,584 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
MOD
Seth Kroger
Treehouse Moderator 56,205 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
Treehouse Moderator 56,205 Points

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

Brian Patterson
Brian Patterson
19,584 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.