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 Building Websites with PHP Slim Basics & Twig Templates Including & Running Slim

michael7williams
michael7williams
9,638 Points

$app->run(); method not working.

I've included 4 echo statements and it's missing the 4th:

I've chmod my root to 777

I'm on Ubuntu 14.04

halp.

<?php
require __DIR__ . '/vendor/autoload.php';
date_default_timezone_set('America/Denver');

//use Monolog\Logger;
//use Monolog\Handler\StreamHandler;
//$log = new Logger('name');
//$log->pushHandler(new StreamHandler('app.txt', Logger::WARNING)$
//$log->addWarning('Oh Noes');

echo '1';

$app = new \Slim\Slim();

echo '2';

$app->get('/hello/:name', function ($name) {
    echo "Hello, $name";
});

echo '3';
$app->run();
echo '4';

?> 
            ```

1 Answer

michael7williams
michael7williams
9,638 Points

Hi guys I actually just figured this out. folder: 000-default.conf - I accidently had my docroot set to /var/www/html/PHP/index.php

I set it to /var/www/html/PHP

and now it works. Case closed..

Lee Ravenberg
Lee Ravenberg
10,018 Points

Thanks for sharing your solution!

Sergey Podgornyy
Sergey Podgornyy
20,660 Points

I use also Ubuntu 14.04 On the file /etc/apache2/sites-available/000-default.conf Root Directory is

DocumentRoot /var/www/html

My php project located in folder /var/www/html/php-website

Maybe you know how to help me?