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 Dependency Management Autoloading

Jose Gutiérrez
Jose Gutiérrez
9,370 Points

app.text file is not created.

I changed the 'app.log' for 'app.txt' but i get this error: Fatal error: Uncaught UnexpectedValueException: The stream or file "app.txt" could not be opened: failed to open stream: Permission denied in /Users/user/Sites/TTHphp/WEBSITEwithComposer/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107. The app.txt wasn't created.

3 Answers

Hi there Jose Gutiérrez!

Most important part in this string is:

The stream or file "app.txt" could not be opened: failed to open stream: Permission denied

If you working under linux(unix system) give rights to the folder in which you are trying to create file.

In terminal write next

$ sudo chmod -R 755 /full/path/to/your/directory/

Where directory is place where you are trying to save\create file "app,txt".

In windows you can follow this guide:

1) Right click on folder. 2) Choose Properties. 3) Choose Security. After this you need to click on Change and choose your current user. After this pop-up window will appear in which you can allow or deny certain rules for that folder.

But, to be honest, I've never encountered such problem on Windows like systems. It seems that you are working under OS X or Linux like system.

Hope this will help.

Best regards.

Jose Gutiérrez
Jose Gutiérrez
9,370 Points

Hi Serhii Lihus. Thanks for your answer. I already changed the permissions and didn't work =(. I restarted the server and even I created the file by myself. Any ideas? I'm working in mac os X El Capitan with apache 2.4 and PHP 7.0

Hi Jose. Try to give same rights to the whole project.

There is no need to restart the server. You just need to refresh browser.

$ sudo chmod -R 755 /www/slim_app/

Best regards.