Error in exception handler Laravel 4.2

'Error in exception handler.' is the common error message that you get when setting up laravel project for the first time. The question is how to solve this issue? how to fix it?

Before we solve it, just let you know that if you enable the debugging mode on laravel, you actually get more information about the error, on what part is the error occurs.

Here's the complete error message when debug mode is enable on laravel:
Error in exception handler: 
The stream or file "/var/www/html/laravel42/app/storage/logs/laravel.log"
could not be opened: failed to open stream:
Permission denied in /var/www/html/laravel42/bootstrap/compiled.php:9138

This error message is cause by the app/storage folder, you need to change the owner and permission for this folder, so the simple solution is to change owner to 'www-data' which is the user that runs the web server (apache) and make sure the folder permission is set to 755.

So here's the solution :
sudo chown -R www-data:www-data app/storage
sudo chmod -R 755 app/storage
Refresh the page again and the error should be gone forever!

if you run laravel without apache web server, the solution above won't work, let say you run laravel using 'php artisan serve', all you have to do is add sudo, so it should be 'sudo php artisan serve'.

~ good luck ~

No comments :

Post a Comment

Leave A Comment...