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.
But well, after running my first installation of this framework I obtained and error, which I explain in following lines:
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
- Go to app/config/app.php
- Modify line to enable debug mode: ‘debug’ => true,
- 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!