“Error in exception handler” in first installation of Laravel framework – SOLVED

Last week, I started to learn how to Lavarel 4 works in order to compare it with other frameworks that I know like: CakePHP and CodeIgniter. First thing that I loved about Laravel is that it works with PHP Composer, that is a great point for Laravel.

laravel-logo

But well, after running my first installation of this framework I obtained and error, which I explain in following lines:

Problem

I was getting this error:

Error in exception handler.

Sometimes the error you are looking for is hidden behind the scenes, so you will need to drill down to figure out what is the actual problem, that is so important: remember the right way to solve something is, first of all, knowing what you are trying to solve…

Trying to find the “real” problem to give a solution

  1. Go to  app/config/app.php
  2. Modify line to enable debug mode:  ‘debug’ => true,
  3. In my case there was a problem with permissions to create log files (laravel.log)
Error in exception handler: The stream or file "/Applications/XAMPP/xamppfiles/htdocs/projects/laravel/first/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/projects/laravel/first/bootstrap/compiled.php:8419

After that, I received a new exception:

file_put_contents(/Applications/XAMPP/xamppfiles/htdocs/projects/laravel/first/app/storage/sessions/7b1ba46df9eaa9ca22a5c5cd1529956266a30c32): failed to open stream: Permission denied

This is clearly an error with permissions to write inside of app/storage/sessions, so a simple chmod command solved that.

You can find more information about Laravel error and logs in this link: http://laravel.com/docs/errors

And that’s it!

Be happy with your code!

5 comments on ““Error in exception handler” in first installation of Laravel framework – SOLVED”

  1. Hi,
    This post is really a life saver. I followed a laravel development guide for the installation of framework which failed to highlight the common issues that you might encounter while installing the framework. I faced the same issue and was staring at a solid wall till i came across this post.

    Thanks mate, keep up the good work!!!

Leave a Reply

Your email address will not be published. Required fields are marked *