Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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?