Laravel - syntax error, unexpected end of file Laravel - syntax error, unexpected end of file php php

Laravel - syntax error, unexpected end of file


There is an error within one of your views. If there is a more detailed stack trace it should show you details of a view, although the name will be an md5() string so it's a bit hard to find. You might want to delete all compiled Blade views in storage/views and let Blade re-compile the views.

If you still get the error then check your views to make sure you have all the proper closing tags, e.g., @endif or @endforeach

Always double check your views for any syntax errors.


I've run into this same error and I was able to fix it by adding spaces to the content within an inline if statement. For example:

Experienced error with:

@if( BLAH )Output@endif

Fixed error with:

@if( BLAH ) Output @endif

This may not be a problem in all cases and it was certainly difficult to track down but it is just one example that can cause this exact error.


A variation of this problem -- I had a php block, which I'd opened with <? as opposed to <?php worked fine on LocalHost/MAMP, but gave the above error under Nginx/Ubuntu 16.04/PHP7 (both Laravel)