-1

I need help. I have a laravel 8 with postgresql in a production server, where from a controller I can perfectly access the records of a test table and display them in the view. Up to here everything ok. But when trying to install livewire to have users, it does not allow me to do the migration.

php artisan migrate:

could not find driver (SQL: select * from information_schema.tables where table_schema = myschema and table_name = migrations and table_type = 'BASE TABLE')

Composer with its latest version. I already tried these commands, without success.

php artisan cache:clear
php artisan config:cache
php artisan optimize:clear

I don't understand how laravel can access the records in a controller but not access to do the migration

I accept ideas of all colors. Thanks!

rendor9
  • 172
  • 2
  • 10
  • Did you try searching for your error? https://stackoverflow.com/questions/35240414/laravel-5-pdoexception-could-not-find-driver, https://stackoverflow.com/questions/51982770/could-not-find-driver-in-laravel, https://stackoverflow.com/questions/25329302/laravel-error-pdoexception-could-not-find-driver-in-postgresql, https://stackoverflow.com/questions/42557693/laravel-pdoexception-could-not-find-driver, https://stackoverflow.com/questions/42909397/laravel-5-4-on-php-7-0-pdo-exception-could-not-find-driver-mysql, https://stackoverflow.com/q/67897858/6089612 ... so many duplicates. – Don't Panic Mar 26 '22 at 02:48
  • Does this answer your question? [Laravel 5 PDOException Could Not Find Driver](https://stackoverflow.com/questions/35240414/laravel-5-pdoexception-could-not-find-driver) – Don't Panic Mar 26 '22 at 02:48
  • And remember CLI where you are running `artisan` has a different PHP config than the http PHP. – Don't Panic Mar 26 '22 at 02:50
  • before asking my question I check all similar questions but none of them is my case. The strange thing is that I can see the records if I do a select query, but when running the migration it explodes. This with laravel 8. I just tried with laravel 7 and it also explodes. I think I'm going to try manually copying the tables, because the migration still doesn't work. This with a postgres 9.5 that is compatible with laravel 7, I'm somewhat surprised by so much problem.! – rendor9 Mar 26 '22 at 14:21
  • What does "*explodes*" mean? – steven7mwesigwa Mar 26 '22 at 15:42
  • means: Illuminate\Database\QueryException. could not find driver (SQL: select * from information_schema.tables where table_schema = myschema and table_name = migrations and table_type = 'BASE TABLE') – rendor9 Mar 26 '22 at 15:50
  • Does this answer your question? [could not find driver in laravel](https://stackoverflow.com/questions/51982770/could-not-find-driver-in-laravel) – steven7mwesigwa Mar 26 '22 at 16:40
  • It sounds like you still didn't check what I mentioned: "*And remember CLI where you are running artisan has a different PHP config than the http PHP*". The PHP config for your web server seems to have the right drivers configured, so that an http request (through your controller) works fine. The CLI (command line) PHP config that `php artisan migrate` uses is different, and apparently does not have the right drivers configured. – Don't Panic Mar 26 '22 at 22:42

1 Answers1

0

Fixed, I checked the server (php -m) and for some unknown reason the postgresql module (pdo_pgsql) was not working. I reinstalled it and it works fine now. thanks to everyone.

sudo apt install php-pgsql
sudo service apache2 reload
rendor9
  • 172
  • 2
  • 10