PDO not found in laravel framework - laravel

I'm using Laravel and I get this error after 2 months using this:
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Class 'PDO' not found in /home/origomal/laravel/config/database.php:16
Any idea?
Pdo is turned on!

May be try clearing config cache:
php artisan config:cache

Related

JWTAuth::user() returns null

I am using Laravel 8 and JWTAuth package for the api requests, often the request throws error when trying to access user info with the following line:
JWTAuth::user()->id
The error: 500 Internal Server Error
ErrorException: Trying to get property 'id' of non-object ...
The only way I could resolve this, temporary however, is to refresh the token. I am wondering that if token is expired it should say token is expired, but seems something else is happening here, which I could not figure it out.
Appreciate any help!
For anyone else facing this issue, working with tokens can quickly create caching issues which can cause headaches if not considered. So in my case resetting the JWT secrete keys fixed the issue.
php artisan jwt:secret
Also for clearing most of the cached sections:
php artisan config:clear && php artisan cache:clear && composer dump-autoload && php artisan view:clear && php artisan route:clear && npm cache clean --force

Laravel Tinker error with SQLite database

Starting from a fresh project:
laravel new new-project
cd new-project
touch storage/database/database.sqlite
Then at .env
DB_CONNECTION=sqlite
DB_DATABASE=storage/database/database.sqlite
DB_FOREIGN_KEYS=true
The migration succeed...
php artisan migrate
php artisan tinker
>>>App\User::all()
But when I try to get all users it returns the following error:
PHP Fatal error: Class 'App/User' not found in Psy Shell code on line 1
What I could be missing?
Recently I reinstalled Laravel...
And I didn't realized I was using version Laravel 8
the models are at /app/Models
So the right command would be:
>>>App\Models\User::all()
i think it has something to do with the namespace alias. Try without the App/
Users::all();

using laravel 5.5 and get error to create my controller?

I am using laravel 5.5 and I get an error when I create my controller.
$ php artisan make:controller MyDatatablesController
I want to create new controller but I get this error:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW)
Your command is perfect their is some error in your project check your recent changes in your project
You're having an error on your own code. Probably it's a code not always executed. Try executing the command in verbose mode to have more information about the error
php artisan make:controller MyDatatablesController -vvv

Class 'Memcached' not found not.not working in laravel

I have PHP 5.4 on a litespeed web server. PHP has been compiled properly with memcached module and we also installed properly memcached library.
In fact the problem suddenly happened without any change at all (server side) when I run the artisan command, I am getting this error:
PHP Fatal error: Class 'Memcached' not found in /laravel/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php on line 52
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Memcached' not found
I googled the issue but was unable to find a solution. I am using Laravel 5.0.
I edited the app/Http/Routes.php and returned new Memcached and the php object was returned properly...
Any help would be appreciated.
I had the same issue.
Replace in .env file:
From : CACHE_DRIVER=memcached<br/>
To : CACHE_DRIVER=file**
then clear cache : php artisan cache:clear

Installing Riari/Laravel forum with composer - error - class not found

I am trying to install Riari forum for Laravel and I follow strictly the steps from http://teamteatime.net/docs/laravel-forum/3.x/installation.md
When I type php artisan vendor:publish in the console, it gives me this error:
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Riari\Forum\ForumServiceProvider' not found
How can I fix it?
You need to put this (Riari\Forum\ForumServiceProvider) in Config/app.php inside service provider in the same format where already some providers are added

Resources