when i try to register and send an email to the user i got this error. It was working till yesterday. From today it gives me this and i cant figure out why.
By the way on local testing this work's. I'm stuck. Help please
ErrorException in compiled.php line 7512:
file_put_contents(/var/www/html/storage/framework/views/53de219dee4f11a2db4f64a2c574ad02db5613f4.php): failed to open stream: Permission denied
in compiled.php line 7512
at HandleExceptions->handleError('2', 'file_put_contents(/var/www/html/storage/framework/views/53de219dee4f11a2db4f64a2c574ad02db5613f4.php): failed to open stream: Permission denied', '/var/www/html/bootstrap/cache/compiled.php', '7512', array('path' => '/var/www/html/storage/framework/views/53de219dee4f11a2db4f64a2c574ad02db5613f4.php', 'contents' => 'Please activate your account by clicking on the following link. <?php echo e(route('auth.activate', $token)); ?> ', 'lock' => false))
at file_put_contents('/var/www/html/storage/framework/views/53de219dee4f11a2db4f64a2c574ad02db5613f4.php', 'Please activate your account by clicking on the following link. <?php echo e(route('auth.activate', $token)); ?> ', '0') in compiled.php line 7512
at Filesystem->put('/var/www/html/storage/framework/views/53de219dee4f11a2db4f64a2c574ad02db5613f4.php', 'Please activate your account by clicking on the following link. <?php echo e(route('auth.activate', $token)); ?> ') in compiled.php line 15769
at BladeCompiler->compile('/var/www/html/resources/views/email/auth/activation.blade.php') in compiled.php line 15682
at CompilerEngine->get('/var/www/html/resources/views/email/auth/activation.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'token' => object(ActivationToken), 'activeToken' => null, 'connection' => null, 'queue' => null, 'delay' => null, 'message' => object(Message))) in compiled.php line 15517
at View->getContents() in compiled.php line 15505
at View->renderContents() in compiled.php line 15489
at View->render() in Mailer.php line 458
at Mailer->getView('email.auth.activation', array('token' => object(ActivationToken), 'activeToken' => null, 'connection' => null, 'queue' => null, 'delay' => null, 'message' => object(Message))) in Mailer.php line 331
at Mailer->addContent(object(Message), 'email.auth.activation', null, null, array('token' => object(ActivationToken), 'activeToken' => null, 'connection' => null, 'queue' => null, 'delay' => null, 'message' => object(Message))) in Mailer.php line 205
at Mailer->send('email.auth.activation', array('token' => object(ActivationToken), 'activeToken' => null, 'connection' => null, 'queue' => null, 'delay' => null, 'message' => object(Message)), object(Closure)) in Mailable.php line 117
at Mailable->send(object(Mailer)) in Mailer.php line 192
at Mailer->send(object(SendActivationToken)) in MailableMailer.php line 99
at MailableMailer->send(object(SendActivationToken)) in SendActivationEmail.php line 30
at SendActivationEmail->handle(object(UserRegistered))
at call_user_func_array(array(object(SendActivationEmail), 'handle'), array(object(UserRegistered))) in compiled.php line 10332
at Dispatcher->Illuminate\Events\{closure}(object(UserRegistered))
at call_user_func_array(object(Closure), array(object(UserRegistered))) in compiled.php line 10266
at Dispatcher->fire('App\Events\UserRegistered') in helpers.php line 480
at event(object(UserRegistered)) in AppServiceProvider.php line 25
at AppServiceProvider->App\Providers\{closure}(object(User))
at call_user_func_array(object(Closure), array(object(User))) in compiled.php line 10266
at Dispatcher->fire('eloquent.created: App\User', array(object(User))) in compiled.php line 11029
at Model->fireModelEvent('eloquent.created: App\User', false) in compiled.php line 10996
at Model->performInsert(object(Builder)) in compiled.php line 10941
at Model->save() in compiled.php line 10599
at Model::create(array('name' => 'Alessandro Mazari', 'surname' => 'Mazari', 'email' => 'alessandro.mazzari.v.l#gmail.com', 'password' => '$2y$10$R/lwIQ5.dgNgArYE3AuyGeDSyUWoILtnT2LvrDGNjV9aDevj9/Xnq', 'hidden_profile' => 'off', 'faction' => 'soon', 'mac_address_handlebar' => '', 'active' => false)) in RegisterController.php line 76
at RegisterController->create(array('_token' => 'Jeh3Amk6XGHDiFz5fqYyBIGYGblbNlZxwzM9r4lJ', 'name' => 'Alessandro Mazari', 'surname' => 'Mazari', 'email' => 'alessandro.mazzari.v.l#gmail.com', 'password' => 'alessa', 'password_confirmation' => 'alessa', 'faction' => 'soon', 'mac_address_handlebar' => '', 'hidden_profile' => 'off')) in compiled.php line 2695
at RegisterController->register(object(Request))
at call_user_func_array(array(object(RegisterController), 'register'), array(object(Request))) in compiled.php line 9584
at Controller->callAction('register', array(object(Request))) in compiled.php line 9611
at ControllerDispatcher->dispatch(object(Route), object(RegisterController), 'register') in compiled.php line 8665
at Route->runController() in compiled.php line 8646
at Route->run(object(Request)) in compiled.php line 8355
at Router->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in RedirectIfAuthenticated.php line 24
at RedirectIfAuthenticated->handle(object(Request), object(Closure)) in compiled.php line 10069
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 10177
at SubstituteBindings->handle(object(Request), object(Closure)) in compiled.php line 10069
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 3312
at VerifyCsrfToken->handle(object(Request), object(Closure)) in compiled.php line 10069
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 13749
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in compiled.php line 10069
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 12155
at StartSession->handle(object(Request), object(Closure)) in compiled.php line 10069
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 13495
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in compiled.php line 10069
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 13432
at EncryptCookies->handle(object(Request), object(Closure)) in compiled.php line 10069
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 10054
at Pipeline->then(object(Closure)) in compiled.php line 8356
at Router->runRouteWithinStack(object(Route), object(Request)) in compiled.php line 8347
at Router->dispatchToRoute(object(Request)) in compiled.php line 8338
at Router->dispatch(object(Request)) in compiled.php line 2575
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 3374
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in compiled.php line 10069
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in compiled.php line 10054
at Pipeline->then(object(Closure)) in compiled.php line 2519
at Kernel->sendRequestThroughRouter(object(Request)) in compiled.php line 2503
at Kernel->handle(object(Request)) in index.php line 53
I cannot comment because I have joined stackoverflow recently and I do not have enough credits so I post an answer.
Laravel needs write permission to storage folder ( and Just this folder). so please run:
sudo chmod -R 7777 storage
I hope I have helped,
regards,
Whenever you see something like failed to open stream: Permission denied', '/var/www/html/bootstrap/cache you should remind yourself that Laravel needs to have write permissions to specific directories.
sudo chmod 777 dir_name is your friend here :)
Quoting the docs:
Directory Permissions
After installing Laravel, you may need to configure some permissions.
Directories within the storage and the bootstrap/cache directories
should be writable by your web server or Laravel will not run.
Related
i have problem in storing data of users ,when user sign up i store half of info in table user and other half in another table ,when hit register butttom i get that error i found that in table user info is stored correctley but in other table nothing is saved.
error
in HasAttributes.php line 818
at HandleExceptions->handleError(2, 'Illegal offset type', 'C:\\wamp\\www\\Menoon1\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Concerns\\HasAttributes.php', 818, array()) in HasAttributes.php line 818
at Model->getCasts() in HasAttributes.php line 803
at Model->hasCast('email', array('date', 'datetime')) in HasAttributes.php line 832
at Model->isDateCastable('email') in HasAttributes.php line 565
at Model->isDateAttribute('email') in HasAttributes.php line 525
at Model->setAttribute('email', 'dde#hg.com') in Model.php line 223
at Model->fill(array('email' => 'dde#hg.com')) in Model.php line 145
at Model->__construct(array('email' => 'dde#hg.com')) in Model.php line 268
at Model->newInstance(array('email' => 'dde#hg.com')) in Builder.php line 1030
at Builder->newModelInstance(array('email' => 'dde#hg.com')) in Builder.php line 723
at Builder->create(array('email' => 'dde#hg.com')) in Model.php line 1332
at Model->__call('create', array(array('email' => 'dde#hg.com'))) in Model.php line 1344
at user_emails->create(array('email' => 'dde#hg.com')) in Model.php line 1344
at Model::__callStatic('create', array(array('email' => 'dde#hg.com'))) in RegisterController.php line 94
at user_emails::create(array('email' => 'dde#hg.com')) in RegisterController.php line 94
at RegisterController->create(array('_token' => 'FZqd7Sc3fQRzmaQ0ImXYebzltzkygJsbKpNcZhv4', 'username' => 'vbnm v bnmm', 'email' => 'dde#hg.com', 'password' => '1111111', 'password_confirmation' => '1111111', 'fname' => 'vbn', 'lname' => 'bnm', 'address' => 'bnm', 'membership' => 'Normal', 'pic' => object(UploadedFile))) in RegistersUsers.php line 33
at RegisterController->register(object(Request))
at call_user_func_array(array(object(RegisterController), 'register'), array(object(Request))) in Controller.php line 55
at Controller->callAction('register', array(object(Request))) in ControllerDispatcher.php line 44
at ControllerDispatcher->dispatch(object(Route), object(RegisterController), 'register') in Route.php line 204
at Route->runController() in Route.php line 160
at Route->run() in Router.php line 559
at Router->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 30
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in RedirectIfAuthenticated.php line 24
at RedirectIfAuthenticated->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in SubstituteBindings.php line 41
at SubstituteBindings->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 65
at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Router.php line 561
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 520
at Router->dispatchToRoute(object(Request)) in Router.php line 498
at Router->dispatch(object(Request)) in Kernel.php line 174
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 30
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in TransformsRequest.php line 30
at TransformsRequest->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in TransformsRequest.php line 30
at TransformsRequest->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ValidatePostSize.php line 27
at ValidatePostSize->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Kernel.php line 149
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
at Kernel->handle(object(Request)) in index.php line 54
at require_once('C:\\wamp\\www\\Menoon1\\public\\index.php') in server.php line 21
user mode
public function useremail()
{
return $this->hasOne('App\user_emails');
}
other table code
public function user()
{
return $this->belongsTo('App\User');
}
code in registercontroller
protected function create(array $data)
{
$fileName = 'null';
Input::file('pic')->store('avatars');
if (Input::file('pic')->isValid()) {
$destinationPath = public_path('uploads/files');
$extension = Input::file('pic')->getClientOriginalExtension();
$fileName = uniqid().'.'.$extension;
Input::file('pic')->move($destinationPath, $fileName);
}
$user= User::create([
'fname' => $data['fname'],
'lname' => $data['lname'],
'address' => $data['address'],
'username' => $data['username'],
'membership' => $data['membership'],
'pic'=>$fileName,
'password' => bcrypt($data['password']),
]);
$useremail=user_emails::create(['email'=>$data['email']]);
// dd($useremail);
$user->useremail()->save($useremail);
return $user;
}
I dont know your model, but if has composite keys, collection cannot get attributes
Try
$user->useremail()->save(new UserEmail(['email'=>$data['email']]));
Given that the model of the useremail is UserEmail.
And your models are mixed up: it should be for App\UserEmail:
public function user()
{
return $this->belongsTo('App\User');
}
and for App\User
public function userEmail()
{
return $this->hasOne('App\user_emails');
}
Notice the convention, for your own good. 'useremail' becomes userEmail'. The model files become User.php and UserEmail.php. Your tables 'users' and 'user_emails' respectively. As thus, the relationship in 'user_emails' should be 'user_id'. And done.
I faced the same issue, it happened because in the Model I defined also a primary key, but it was already set in the database with a clause when the table was created.
I was trying to upgrade a Laravel 4.1 application to 5.1 on WAMP, and got this error:
RuntimeException in Request.php line 775: Session store not set on
request.
in
D:\wamp\www\laravel-5.1\vendor\laravel\framework\src\Illuminate\Http\Request.php
line 775 at Request->session() in
D:\wamp\www\laravel-5.1\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php
line 137 at VerifyCsrfToken->addCookieToResponse(object(Request),
object(Response)) in VerifyCsrfToken.php line 64 at
VerifyCsrfToken->handle(object(Request), object(Closure)) at
call_user_func_array(array(object(VerifyCsrfToken), 'handle'),
array(object(Request), object(Closure))) in Pipeline.php line 124 at
Pipeline->Illuminate\Pipeline{closure}(object(Request)) at
call_user_func(object(Closure), object(Request)) in Pipeline.php line
30 at Pipeline->Illuminate\Routing{closure}(object(Request)) at
call_user_func(object(Closure), object(Request)) in Pipeline.php line
103 at Pipeline->then(object(Closure)) in ControllerDispatcher.php
line 96 at
ControllerDispatcher->callWithinStack(object(BrowseController),
object(Route), object(Request), 'getBrowseRecent') in
ControllerDispatcher.php line 54 at
ControllerDispatcher->dispatch(object(Route), object(Request),
'App\Http\Controllers\BrowseController', 'getBrowseRecent') in
Route.php line 174 at Route->runController(object(Request)) in
Route.php line 140 at Route->run(object(Request)) in Router.php line
703 at Router->Illuminate\Routing{closure}(object(Request)) at
call_user_func(object(Closure), object(Request)) in Pipeline.php line
139 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in
ViewThrottleMiddleware.php line 55 at
ViewThrottleMiddleware->handle(object(Request), object(Closure)) at
call_user_func_array(array(object(ViewThrottleMiddleware), 'handle'),
array(object(Request), object(Closure))) in Pipeline.php line 124 at
Pipeline->Illuminate\Pipeline{closure}(object(Request)) at
call_user_func(object(Closure), object(Request)) in Pipeline.php line
30 at Pipeline->Illuminate\Routing{closure}(object(Request)) at
call_user_func(object(Closure), object(Request)) in Pipeline.php line
103 at Pipeline->then(object(Closure)) in Router.php line 705 at
Router->runRouteWithinStack(object(Route), object(Request)) in
Router.php line 678 at Router->dispatchToRoute(object(Request)) in
Router.php line 654 at Router->dispatch(object(Request)) in Kernel.php
line 246 at
Kernel->Illuminate\Foundation\Http{closure}(object(Request)) at
call_user_func(object(Closure), object(Request)) in Pipeline.php line
139 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in
CheckForMaintenanceMode.php line 44 at
CheckForMaintenanceMode->handle(object(Request), object(Closure)) at
call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'),
array(object(Request), object(Closure))) in Pipeline.php line 124 at
Pipeline->Illuminate\Pipeline{closure}(object(Request)) at
call_user_func(object(Closure), object(Request)) in Pipeline.php line
103 at Pipeline->then(object(Closure)) in Kernel.php line 132 at
Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line
99 at Kernel->handle(object(Request)) in index.php line 54
The storage folder is writable, and the session driver used is file. I searched the whole project for session(), but found it nowhere. What can I do to correct this error? Thanks!
The session.php is as follows:
<?php
return [
'driver' => env('SESSION_DRIVER', 'file'),
'lifetime' => 120,
'expire_on_close' => false,
'encrypt' => false,
'files' => storage_path('framework/sessions'),
'connection' => null,
'table' => 'sessions',
'lottery' => [2, 100],
'cookie' => 'laravel_session',
'path' => '/',
'domain' => null,
'secure' => false,
];
Edit 1: I found the problem is in the controller. There is a line:
$this->middleware('csrf', [ 'on' => 'post' ]);
I commented it out and it worked. But I didn't figure out why it caused the problem yet.
Look at #Cas Bloem his answer here this helped me out amazingly:
Laravel - Session store not set on request
That's why it wasn't working for me. Cause you're using a session that is expection matching CSRF tokens (is my best guess, I'm new to Laravel myself).
Also if you go to app->http->middleware->VerifyCsrfToken this is were you can add routes to the array that won't be checked for CSRF verification. This plus Cas Bloem his fix (place routes in different section in routes.php) fixed my problem. I'm just developing/learning on localhost right now but need to implement this later on.
Hope this helps/clears thing up!
I'm just beginning laravel and when i try to return articles JSON from sqlite, i get this driver error.
public function index(){
$articles = \App\Article::all();
return $articles;
}
Whoops, looks like something went wrong.
1/1 PDOException in Connector.php line 55: could not find driver
in Connector.php line 55
at PDO->__construct('sqlite:/srv/http/laravel/storage/database.sqlite', null, null, array('0', '2', '0', false, false)) in Connector.php line 55
at Connector->createConnection('sqlite:/srv/http/laravel/storage/database.sqlite', array('driver' => 'sqlite', 'database' => '/srv/http/laravel/storage/database.sqlite', 'prefix' => '', 'name' => 'sqlite'), array('0', '2', '0', false, false)) in SQLiteConnector.php line 37
at SQLiteConnector->connect(array('driver' => 'sqlite', 'database' => '/srv/http/laravel/storage/database.sqlite', 'prefix' => '', 'name' => 'sqlite')) in ConnectionFactory.php line 60
at ConnectionFactory->createSingleConnection(array('driver' => 'sqlite', 'database' => '/srv/http/laravel/storage/database.sqlite', 'prefix' => '', 'name' => 'sqlite')) in ConnectionFactory.php line 49
at ConnectionFactory->make(array('driver' => 'sqlite', 'database' => '/srv/http/laravel/storage/database.sqlite', 'prefix' => ''), 'sqlite') in DatabaseManager.php line 175
at DatabaseManager->makeConnection('sqlite') in DatabaseManager.php line 67
at DatabaseManager->connection(null) in Model.php line 3245
at Model::resolveConnection(null) in Model.php line 3211
at Model->getConnection() in Model.php line 1914
at Model->newBaseQueryBuilder() in Model.php line 1857
at Model->newQueryWithoutScopes() in Model.php line 1831
at Model->newQuery() in Model.php line 667
at Model::all() in ArticlesController.php line 14
at ArticlesController->index()
at call_user_func_array(array(object(ArticlesController), 'index'), array()) in Controller.php line 256
at Controller->callAction('index', array()) in ControllerDispatcher.php line 164
at ControllerDispatcher->call(object(ArticlesController), object(Route), 'index') in ControllerDispatcher.php line 112
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114
at ControllerDispatcher->callWithinStack(object(ArticlesController), object(Route), object(Request), 'index') in ControllerDispatcher.php line 69
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\ArticlesController', 'index') in Route.php line 201
at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
at Route->run(object(Request)) in Router.php line 704
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 706
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 671
at Router->dispatchToRoute(object(Request)) in Router.php line 631
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42`enter code here`
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 54
at require_once('/srv/http/laravel/public/index.php') in server.php line 21
Please be sure you've installedpdo and pdo_sqlite extensions properly.
php -v will output if are there any missing extension files.
You should have these packages sqlite, php5-sqlite . And built with pecl. pecl install pdo && pecl install pdo_sqlite . Lastly you should enable pdo, pdo_sqlite extensions in your php.ini. According to your phpinfo() output, your php.ini file is /etc/php/php.ini
And again according to your phpinfo() output, your extension folder is /usr/lib/php/modules/ . There should be pdo_sqlite.so file in this directory.
I found out that if we can write to the database, then the connection is working fine. We all faced the issue when trying to retrieve from database. I resolved this issue by restarting the server. That worked for me in Ubuntu 14.04
I am trying out the sample Sentinel methods. I just want to register a user and authenticate him using his username.
I modified the user table by replacing the email attribute with username and did the migration. Here is my users table.
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('username');
$table->string('password');
$table->text('permissions')->nullable();
$table->timestamp('last_login')->nullable();
$table->timestamps();
$table->engine = 'InnoDB';
$table->unique('username');
});
When I try to call the below method to register a sample user, I am getting an error.
Code:
$credentials = [
'username' => 'testuser123',
'password' => '123'
];
$activation = Sentinel::registerAndActivate($credentials);
Error:
InvalidArgumentException in IlluminateUserRepository.php line 271:
No [login] credential was passed.
in IlluminateUserRepository.php line 271
at IlluminateUserRepository->validateUser(array('username' => 'testuser123', 'password' => '123')) in IlluminateUserRepository.php line 154
at IlluminateUserRepository->validForCreation(array('username' => 'testuser123', 'password' => '123')) in Sentinel.php line 164
at Sentinel->register(array('username' => 'testuser123', 'password' => '123'), true) in Sentinel.php line 191
at Sentinel->registerAndActivate(array('username' => 'testuser123', 'password' => '123')) in Sentinel.php line 97
at Sentinel::__callStatic('registerAndActivate', array(array('username' => 'testuser123', 'password' => '123'))) in AuthenticationController.php line 196
at Sentinel::registerAndActivate(array('username' => 'testuser123', 'password' => '123')) in AuthenticationController.php line 196
at AuthenticationController->testFunction()
at call_user_func_array(array(object(AuthenticationController), 'testFunction'), array()) in Controller.php line 246
at Controller->callAction('testFunction', array()) in ControllerDispatcher.php line 162
at ControllerDispatcher->call(object(AuthenticationController), object(Route), 'testFunction') in ControllerDispatcher.php line 107
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 108
at ControllerDispatcher->callWithinStack(object(AuthenticationController), object(Route), object(Request), 'testFunction') in ControllerDispatcher.php line 67
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\AuthenticationController', 'testFunction') in Route.php line 204
at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
at Route->run(object(Request)) in Router.php line 701
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in Router.php line 703
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 670
at Router->dispatchToRoute(object(Request)) in Router.php line 628
at Router->dispatch(object(Request)) in Kernel.php line 214
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 55
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 61
at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 36
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 40
at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in Kernel.php line 115
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 84
at Kernel->handle(object(Request)) in index.php line 53
at require_once('/home/pranavaghanan/Documents/GitHub Projects/To Integrate For Release 1/SEP/public/index.php') in server.php line 21
Is there any way to correct the problem?
Thanks.
The problem is that in the credentials parameter it requires email not username.
So change it like this and try agian:
$credentials = [
'email' => 'testuser123',
'password' => '123'
];
In case you have to use username instead of email to authenticate, read this answer.
I'm using socialite ~2 on Laravel 5.1. I can do twitter and facebook logins fine but google fails with the log I've included below.
I'm using a vagrant with a self signed SSL that I have accepted in the browser before attempting to login. Is this an API issue or a problem with local development environment and google?
NOTE: I am using the RAPPASOFT Laravel 5.1 Boilerplate
https://github.com/rappasoft/laravel-5-boilerplate
ClientException in Middleware.php line 69: Client error: 401
in Middleware.php line 69
at Middleware::GuzzleHttp\{closure}(object(Response)) in Promise.php line 199
at Promise::callHandler('1', object(Response), array(object(Promise), object(Closure), null)) in Promise.php line 152
at Promise::GuzzleHttp\Promise\{closure}() in TaskQueue.php line 60
at TaskQueue->run() in CurlMultiHandler.php line 96
at CurlMultiHandler->tick() in CurlMultiHandler.php line 123
at CurlMultiHandler->execute(true) in Promise.php line 240
at Promise->invokeWaitFn() in Promise.php line 217
at Promise->waitIfPending() in Promise.php line 261
at Promise->invokeWaitList() in Promise.php line 219
at Promise->waitIfPending() in Promise.php line 62
at Promise->wait() in Client.php line 130
at Client->request('post', 'https://accounts.google.com/o/oauth2/token', array('form_params' => array('client_id' => '463541023677-a5gv76hf89htpask5kna33gptgnk3l2u.apps.googleusercontent.com', 'client_secret' => 'I2XqAx6U03igS5vFPopL_yLTM', 'code' => '4/1IoVx9wV7qbTTdgZrCsk8bvNt8qLVo0CAM1qimK_clQ', 'redirect_uri' => 'https://dpsg.dev/auth/login/google', 'grant_type' => 'authorization_code'))) in Client.php line 88
at Client->__call('post', array('https://accounts.google.com/o/oauth2/token', array('form_params' => array('client_id' => '463541023677-a5gv76hf89htpask5kna33gptgnk3l2u.apps.googleusercontent.com', 'client_secret' => 'I2XqAx6U03igS5vFPopL_yLTM', 'code' => '4/1IoVx9wV7qbTTdgZrCsk8bvNt8qLVo0CAM1qimK_clQ', 'redirect_uri' => 'https://dpsg.dev/auth/login/google', 'grant_type' => 'authorization_code')))) in GoogleProvider.php line 55
at Client->post('https://accounts.google.com/o/oauth2/token', array('form_params' => array('client_id' => '463541023677-a5gv76hf89htpask5kna33gptgnk3l2u.apps.googleusercontent.com', 'client_secret' => 'I2XqAx6U03igS5vFPopL_yLTM', 'code' => '4/1IoVx9wV7qbTTdgZrCsk8bvNt8qLVo0CAM1qimK_clQ', 'redirect_uri' => 'https://dpsg.dev/auth/login/google', 'grant_type' => 'authorization_code'))) in GoogleProvider.php line 55
at GoogleProvider->getAccessToken('4/1IoVx9wV7qbTTdgZrCsk8bvNt8qLVo0CAM1qimK_clQ') in AbstractProvider.php line 187
at AbstractProvider->user() in EloquentAuthenticationRepository.php line 137
at EloquentAuthenticationRepository->getSocialUser('google') in EloquentAuthenticationRepository.php line 106
at EloquentAuthenticationRepository->loginThirdParty(array('state' => '4dd7e363d9c56bbfe7e3fd046f64ea367748091d', 'code' => '4/1IoVx9wV7qbTTdgZrCsk8bvNt8qLVo0CAM1qimK_clQ'), 'google') in AuthController.php line 99
at AuthController->loginThirdParty(object(Request), 'google')
at call_user_func_array(array(object(AuthController), 'loginThirdParty'), array(object(Request), 'provider' => 'google')) in compiled.php line 8445
at Controller->callAction('loginThirdParty', array(object(Request), 'provider' => 'google')) in compiled.php line 8514
at ControllerDispatcher->call(object(AuthController), object(Route), 'loginThirdParty') in compiled.php line 8494
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in compiled.php line 9151
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in compiled.php line 9133
at Pipeline->then(object(Closure)) in compiled.php line 8495
at ControllerDispatcher->callWithinStack(object(AuthController), object(Route), object(Request), 'loginThirdParty') in compiled.php line 8480
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\Frontend\Auth\AuthController', 'loginThirdParty') in compiled.php line 7455
at Route->runWithCustomDispatcher(object(Request)) in compiled.php line 7426
at Route->run(object(Request)) in compiled.php line 7079
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in compiled.php line 9151
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in RedirectIfAuthenticated.php line 41
at RedirectIfAuthenticated->handle(object(Request), object(Closure))
at call_user_func_array(array(object(RedirectIfAuthenticated), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9143
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in compiled.php line 9133
at Pipeline->then(object(Closure)) in compiled.php line 7080
at Router->runRouteWithinStack(object(Route), object(Request)) in compiled.php line 7068
at Router->dispatchToRoute(object(Request)) in compiled.php line 7053
at Router->dispatch(object(Request)) in compiled.php line 2066
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in compiled.php line 9151
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 2687
at VerifyCsrfToken->handle(object(Request), object(Closure)) in VerifyCsrfToken.php line 17
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9143
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 12399
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9143
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 11048
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9143
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 12137
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9143
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 12076
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9143
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 2737
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9143
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in compiled.php line 9133
at Pipeline->then(object(Closure)) in compiled.php line 2013
at Kernel->sendRequestThroughRouter(object(Request)) in compiled.php line 1999
at Kernel->handle(object(Request)) in index.php line 54
Check if you have Google+ API enable.