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.1wwwlaravelview.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
.
miken32
41.1k16 gold badges106 silver badges149 bronze badges
asked Apr 20, 2013 at 3:23
Ivanka TodorovaIvanka Todorova
9,78416 gold badges59 silver badges100 bronze badges
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.
answered Apr 20, 2013 at 3:29
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.
answered Jun 12, 2014 at 20:19
1
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)
answered Aug 16, 2016 at 16:31
1
you should remove a character from view file. for example my character was «,» (a comma) before some «@endfor». when i remove those worked!
answered Sep 20, 2017 at 7:42
I know this question is stupid. I already tried to find this error for several hours. I still can’t figure it out what I missing…
@extends('app')
@section('content')
<div class="container">
<div class="span7 offset1">
<iframe width="600" height="315" src="//www.youtube.com/embed/<?php echo $_POST['id']; ?>" frameborder="0" allowfullscreen></iframe>
</div>
<div id="tags">
<?php
foreach(json_decode($_POST['data']) as $value) {?>
<h3> <?php echo $value->Name;?> :
<small>
<?php foreach( $value->Times as $times ) {
echo gmdate("i:s", $times).' ' ;
}?>
</small>
</h3>
<br>
<?php}?>
</div>
</div>
@endsection
error message
FatalErrorException in f414a2a722d122735d2198f9a7f0ae6a line 26:
syntax error, unexpected end of file
asked Dec 2, 2015 at 16:50
user3927463user3927463
1651 gold badge2 silver badges13 bronze badges
5
Change
<?php}?>
to
<?php } ?>
answered Nov 23, 2017 at 6:53
user3927463user3927463
1651 gold badge2 silver badges13 bronze badges
Due to the syntax error. The . Never put }, it will confuse the syntax and you will get error. Connect to HTML via Druppal for more Laravel system or contact Bootstrap for more MySql
answered Feb 28, 2017 at 9:05
I have an interesting situation to which I can’t figure out why it is happening. I am getting the error stated in the title. This is happening on a Blade component. I have a Blade component that accepts some values and creates Label and Input Checkbox HTML elements with those values. Now, I want to specify whether the checkbox should be «checked» or not, to which I have {{ $attributes }} on the component for that. Ternary or simple if statements both yield the same results.
input-checkbox.blade.php (the component)
@props([
'for' => 'undefined_for',
'name' => 'undefined_name',
'value' => 'undefined_value',
'aria_label' => 'undefined_aria_label'
])
<label for="{{ $for }}" class="form-label">
{{ $slot }}
</label>
<input type="checkbox"
class="form-check-input me-1"
name="{{ $name }}"
id="{{ $for }}"
value="{{ $value }}"
aria-label="{{ $aria_label }}"
{{ $attributes }}>
edit.blade.php (where component is used — note, this is all the code there is in this file)
<x-input-checkbox
name="roles[]"
for="role_{{ $role->role }}"
value="{{ $role->role }}"
aria_label="Role {{ $role->role }}"
{{ $role->checked ? 'checked' : '' }}> // <<< this is the line that causes problem
Role Label Text
</x-input-checkbox>
OR
<x-input-checkbox
name="roles[]"
for="role_{{ $role->role }}"
value="{{ $role->role }}"
aria_label="Role {{ $role->role }}"
@if($role->checked)checked@endif> // <<< this too fails
Role Label Text
</x-input-checkbox>
OR
<x-input-checkbox
name="roles[]"
for="role_{{ $role->role }}"
value="{{ $role->role }}"
aria_label="Role {{ $role->role }}"
@if($role->checked){{ 'checked' }}@endif> // <<< this too fails
Role Label Text
</x-input-checkbox>
But this does work, plain HTML.
<label for="role_{{ $role->role }}" class="form-label">
Role Label Text
</label>
<input type="checkbox"
class="form-check-input me-1"
name="roles[]"
id="role_{{ $role->role }}"
value="{{ $role->role }}"
aria-label="Role {{ $role->role }}"
{{ $role->checked ? 'checked' : '' }}> // <<< this works, the box is marked checked if true
Any assistance is greatly appreciated. Thanks.
I use Laravel’s Socialite.
I tried to implement login using Github authentication and wrote the following code.
<? php
namespace App Http Controllers Auth;
use App Http Controllers Controller;
use Illuminate Foundation Auth AuthenticatesUsers;
use Socialite;// Added!
use Illuminate Http Request;// Added!
use Illuminate Support Facades DB;
class LoginController extends Controller
{
/ *
| ------------------------------------------------- -------------------------
| Login Controller
| ------------------------------------------------- -------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
to conveniently provide its functionality to your applications.
|
* /
use AuthenticatesUsers;
/ **
* Where to redirect users after login.
*
* @var string
* /
protected $redirectTo = '/ home';
/ **
* Create a new controller instance.
*
* @return void
* /
public function __construct ()
{
$this->middleware ('guest')->except ('logout');
}
/ **
* Redirect users to GitHub authentication page
*
* @return Illuminate Http Response
* /
public function redirectToProvider () // Added!
{
return Socialite :: driver ('github')->scopes (['read: user', 'public_repo'])->redirect ();
}
/ **
* Get user information from GitHub
*
* @return Illuminate Http Response
* /
public function handleProviderCallback (Request $request)
{
$github_user = Socialite :: driver ('github')->user ();
$now = date ("Y/m/d H: i: s");
$app_user = DB :: select ('select * from public.user where github_id =?', [$github_user->user ['login']]);
if (empty ($app_user)) {
DB :: insert ('insert into public.user (github_id, created_at, updated_at) values (?,?,?)', [$Github_user->user ['login'], $now, $now]);
}
$request->session ()->put ('github_token', $github_user->token);
return redirect ('github');
}
The following error will be displayed.
Symfony Component Debug Exception FatalThrowableError (E_PARSE)
syntax error, unexpected end of file, expecting function (T_FUNCTION) or const (T_CONST)
I understand that something unexpected is written at the end of the file, but
(T_FUNCTION) or const (T_CONST)
What is that is clogged because it does not come out even if you google.
If i know the solution to the error, please let me know. Thank you in advance.