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

index.php Server Error 500 - using MAMP

Hey,

I'm following the video: "Build a Basic PHP Website". My index.php file was loading before (in MAMP) but now I am getting a server error.

All the other .php pages work just fine.

Here's the code in the index.php file:

<?php include("inc/data.php"); include("inc/functions.php") $pageTitle = "Personal Media Library"; $section = null;

include("inc/header.php"); ?> <div class="section catalog random">

        <div class="wrapper">

            <h2>May we suggest something?</h2>

            <ul class="items">
                <?php 
                $random = array_rand($catalog,4);
                foreach($random as $id){
                    echo get_item_html($id,$catalog[$id]);
                } 
                ?>                              
            </ul>

        </div>

    </div>

<?php include("inc/footer.php"); ?>

2 Answers

You should be getting a syntax error as you don't have a ; after this statement:

include("inc/functions.php")

Also, the final include doesn't appear to have any php tags around it:

include("inc/footer.php"); 

That fixed it! Thank you :)