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

App.txt messages do not appear

I cannot figure out how to get his moved to the section Building Websites with PHP-->Namespacing

I followed some advice as I had an earlier issue with the logger and in doing so deleted my app.txt and then created a new app.txt. FWIW: The app.txt had messages in it but since I deleted it, it no longer does.

Now this is the error I am getting

Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "app.txt" could not be opened: failed to open stream: Permission denied' in /home/treehouse/workspace/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:87 Stack trace: #0 /home/treehouse/workspace/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array) #1 /home/treehouse/workspace/vendor/monolog/monolog/src/Monolog/Logger.php(289): Monolog\Handler\AbstractProcessingHandler->handle(Array) #2 /home/treehouse/workspace/vendor/monolog/monolog/src/Monolog/Logger.php(341): Monolog\Logger->addRecord(300, 'Foo', Array) #3 /home/treehouse/workspace/index.php(13): Monolog\Logger->addWarning('Foo') #4 {main} thrown in /home/treehouse/workspace/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 87

This is the code I have

<?php

require __DIR__ . '/vendor/autoload.php';

date_default_timezone_set ('America/New_York');

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

$log = new Logger('name');
$log->pushHandler(new StreamHandler('app.txt', Logger::WARNING));

$log->addWarning('Foo');

echo "hello, world";


?>

It is not a browser error as I have cleared the cache, this is what my file tree looks like http://pasteboard.co/2yN9nF7C.png, and I have refreshed my file tree.

Dale Severude
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Dale Severude
Full Stack JavaScript Techdegree Graduate 71,324 Points

I think I had the same error. The error went away when i deleted app.txt and then let the program create a new app.txt file. However, right now, I am not able to repro this error anymore.