20

I have a website which works fine on host, but I'm currently trying to install it on localhost.

I've downloaded everything and configured to work on localhost - Database & URL.

The problem is this error:

Unhandled Exception

Message:

syntax error, unexpected end of file Location:

C:\Program Files (x86)\EasyPHP-12.1\www\laravel\view.php(386) : eval()'d code on line 118

And I don't know what causes it. Any solutions?

P.S. I've setup in my windows' host file 127.0.0.1 myproject.dev.

4 Answers 4

38

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.

Sign up to request clarification or add additional context in comments.

8 Comments

It looked like I havent had my short tags turned on. :( Everything is ok so far.
That would do it too! Instead of using short tags you should take a look at Blade. :)
I think that blade is convertion @foreach($foo as $bar) to <? foreach($foo as $bar): ?>. Anyways I fixed this. Thanks for your response.
In my case it was a missing semicolon in the routes file. It's a shame the error message doesn't even mention the file name!
@LuigiLopez Too long ago to remember today, but I guess, at the end of the route definition . . .
|
8

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.

1 Comment

I had this problem too, and this solved it. This issue seems to have happened because we upgraded to Laravel 4.2; the old code works fine in Laravel 4.1. See also this question.
5

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)

1 Comment

That's probably due to disabled short tags in your php.ini config. Enabling them is pretty easy.
0

you should remove a character from view file. for example my character was "," (a comma) before some "@endfor". when i remove those worked!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.