In laravel 4 when you try to render a view that does not exists in app\views or a view with undefined variables laravel will throw an exception or show error that helps with debug.
I have a fresh installation of laravel 5.0.13 and am having a tough time troubleshooting a blade template that shows a blank page when i render a view that does not exists instead or a template with undefined variables instead of throwing an exception or error which will clue me in when debug.
I have installed filp/whoops:~1.0. but still recieve a blank page
class ProfileController extends Controller
{
public function index()
{
return view('indexx'); //this view does not really exist
}
}
The file indexx does not exist in my resources/views and i expect Laravel to throw an exception but am getting a blank page instead, why?
Also when i render a view that exists with some undefined variables i simply get a blank page
Example:
class ProfileController extends Controller {
public function index()
{
return view('index'); //this view exists
}
}
The content of resources/views/index
{!! $this_variable_was_not_passed_an_I_expect_error !!}
As you can see in the view file above the variable does not exist by laravel will simply show a blank page instead of throwing an exception or some debug error.
Also to note i change my laravel default view in config/views
'paths' => [
//realpath(base_path('resources/views'))
realpath(base_path('resources/themes/default'))
],
And laravel was able to render views from resources/themes/default as long as there is no error in the template however, if any error was encountered such ar undefined variable a laravel displays a blank page instead of showing error message
Also to mention that I install virtual box and vagrant on window 7
Could this be a bug or something? Please assist.
An alternative solution which helped me, is running
I deployed with git which auto ignores some files. running composer install fixed it for me.
I don't really know why this happened but its now working as required after i run
vagrant destroy
to destroy homestead VMand then
vagrant up
- to create the VMThe error messages has now showing up instead of blank page:
I got the same problem but here comes the reason and the solution: The logfiles in storage/logs needs to be owned/writable by the webserver user. Otherwise L5 gives you a blank page.
I run "php artisan ..." always as root. If an exception was thrown and Laravel creates a new logfile, then it's owned by root. On my Debian i run in the project root folder:
chown www-data.root * -R
to solve this problem.Try to change permission on the storage folder:
It worked for me.
//lavarel 4 * Add this to app/start/gobal.php
//lavarel 5 * Add this to app/Exceptions/Handler.php