Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display errors on laravel 4?

I'm trying to create an app on Laravel 4 beta but I can't debug it because it doesn't show any error, display_errors is on, error_reporting is E_ALL and debug => true (config/app.php). When I try to do an error on public/index.php it shows a parse error, but when I do it on the router it just shows a blank page (White screen of death). How can I fix this?

Thank you

like image 270
Blue Genie Avatar asked Jan 28 '13 18:01

Blue Genie


People also ask

How do I show laravel errors?

How do I show laravel validation errors in blade? You can call any() method on $errors variable to check that there are any validation errors exist in it or not. It returns 1 if any errors exist in $errors variable. After that you can call foreach method on $errors->all() and display message using $error variable.

How do I view laravel logs?

You can see the generated log entries in storage/logs/laravel.

What is error handling in laravel?

Laravel makes it easy to display custom error pages for various HTTP status codes. For example, if you wish to customize the error page for 404 HTTP status codes, create a resources/views/errors/404.blade.php view template. This view will be rendered on all 404 errors generated by your application.


1 Answers

@Matanya - have you looked at your server logs to see WHAT the error 500 actually is? It could be any number of things

@Aladin - white screen of death (WSOD) can be diagnosed in three ways with Laravel 4.

Option 1: Go to your Laravel logs (app/storage/logs) and see if the error is contained in there.

Option 2: Go to you PHP server logs, and look for the PHP error that is causing the WSOD

Option 3: Good old debugging skills - add a die('hello') command at the start of your routes file - then keep moving it deeper and deeper into your application until you no longer see the 'hello' message. Using this you will be able to narrow down the line that is causing your WSOD and fix the problem.

like image 67
Laurence Avatar answered Sep 21 '22 17:09

Laurence