Error in exception handler. - Laravel

ApacheLaravel

Apache Problem Overview


It's a Laravel-install related question. I have a public-facing Unix server setup:

<VirtualHost *:80>
ServerAdmin webmaster@mydomain.org
DocumentRoot "/var/www/mydomain"
ServerName mydomain.org
ServerAlias www.mydomain.org
ErrorLog "/var/log/mydomain.org-error_log"
CustomLog "/var/log/mydomain.org-access_log" common
</VirtualHost>

I can serve documents fine out of /var/www/mydomain i.e. http://mydomain.org/test.php with test.php containing:

<?php echo 'test';

works fine.

In bash, with Laravel installed through Composer and looking at the files:

# ls /var/www/mydomain/my-laravel-project

.gitattributes  CONTRIBUTING.md artisan         composer.json   phpunit.xml readme.md       vendor
.gitignore      app             bootstrap       composer.lock   public          server.php

So when I browse to:

http://mydomain.org/my-laravel-project/public/

why does my application report:

Error in exception handler. 

in the browser - on a blank white screen? I'm expecting to see the Laravel splash screen.

Moreover, the log files don't reveal anything either.

Apache Solutions


Solution 1 - Apache

The safer option would be to change the group of the storage directories to your web servers group (usually apache or www-data, but this can vary between the different operating systems) and keep the permissions as of the directory as 775.

chgrp -R www-data app/storage

Or with chown.

chown -R :www-data app/storage

Then make sure directory permissions are 775.

chmod -R 775 app/storage

From the Laravel web site:

> Laravel may require one set of permissions to be configured: folders > within app/storage require write access by the web server.

Solution 2 - Apache

Laravel 5.2

chmod -R 777 storage

Older Laravel chmod 777 app/storage/*

Note if you've got a reasonably locked down dedicated server with no user accounts other than your own, 777 shouldn't pose any more security risk than anything else. There'd have to be some other vulnerability for a malicious user to take advantage of that, and at that point, the 777 permission is probably moot anyway. If however you are on a shared server with other users you do not trust, then you'll need to look into more complicated permissions or check if your hosting provider has already provided isolation.

They should really put this in the quick start docs and provide examples for various setups. You may also have to run it again after the first load as more directories are created automatically. Look in your logs for write errors.

Also your DocumentRoot should be /path/to/laravel-project/public

Solution 3 - Apache

I deleted old sessions inside app/storage/sessions folder and give a 775 permission to app/storage after that it's working like a fire!

chmod -R 775 app/storage

Good luck!

Solution 4 - Apache

The bandwagon has passed on this a long long time ago, but still I have another piece of advice regarding "Error in exception handler."

I had this happening to me when I ran "php artisan", which is a good way to assess if your environment is working in general.

I ran it and it gave me that error, and I couldn't pinpoint the problem till I edited the artisan file in the root directory of my project and add a try catch statement:

try {
    $artisan = Illuminate\Console\Application::start($app);
}
catch (Exception $e)
{
    dd($e->getMessage());
}

At which point I finally saw an enlightening message:

string(41) "Connection refused [tcp://127.0.0.1:6379]"

which in my case was a bad redis configuration, but in your case could be anything.

I hope this helps someone, or at least next time I get here I will find my own answer.

Solution 5 - Apache

The shortest way to solve this is starting artisan with sudo. This will give artisan all the permissions it needs and won't make any security troubles as well.

so instead starting artisan serve with:

$ php artisan serve

try using:

$ sudo php artisan serve 

thus you wont have to make any permission changes

Solution 6 - Apache

I have the same issue, I just change the permission from directory app/storage to 775 with the chmod command line

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestioncookieView Question on Stackoverflow
Solution 1 - ApacheJason LewisView Answer on Stackoverflow
Solution 2 - ApachemalhalView Answer on Stackoverflow
Solution 3 - ApacheAbdulaziz NoorView Answer on Stackoverflow
Solution 4 - ApacheNiRRView Answer on Stackoverflow
Solution 5 - ApacheSkeletorView Answer on Stackoverflow
Solution 6 - ApacheCaio CutrimView Answer on Stackoverflow