Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Homestead 502 Bad Gateway instead of Whoops for PHP errors

My Homestead Vagrant virtual machine is returning me a 502 Bad Gateway instead of a Laravel Whoops error for some PHP errors (like class not found, some kind of parse errors etc ...).

Does someone have the solution for briging Whoops for all PHP errors ?

I could get the error reading manually /var/log/nginx/<my_vhost>.app-error.log like this :

2014/11/27 15:15:44 [error] 1300#0: *12 FastCGI sent in stderr: "PHP message: PHP Fatal error: <ERROR HERE> on line <LINE>

But it is very annoying for debugging ...

Homestead version : 0.2.0. Laravel version : 4.2

like image 209
Ifnot Avatar asked Nov 27 '14 15:11

Ifnot


1 Answers

After some searches I found a working solution.

I have to add the following lines to my /etc/nginx/nginx.conf :

http {
    ...
    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;
    ...
}

Dont forget to edit with root rights with sudo

sudo nano /etc/nginx/nginx.conf

And then restart nginx

sudo /etc/init.d/nginx restart

Source of the info : https://laracasts.com/discuss/channels/general-discussion/whoops-doesnt-show-any-errors-homestead-20

like image 139
Ifnot Avatar answered Nov 15 '22 03:11

Ifnot