I have a Laravel project that I need to give some maintenance, so I cloned the project, ran composer update
and then tried to migrate with php artisan migrate
(after creating the DB on MySQL)...
I'm on Ubuntu 20.04, using PHP 7.4 with Laravel 8.
I get this error:
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql.so' (tried: /usr/lib/php/20190902/pdo_mysql.so (/usr/lib/php/20190902/pdo_mysql.so: undefined symbol: mysqlnd_allocator), /usr/lib/php/20190902/pdo_mysql.so.so (/usr/lib/php/20190902/pdo_mysql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Illuminate\Database\QueryException
could not find driver (SQL: select * from information_schema.tables where table_schema = escola_da_qualidade and table_name = migrations and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:685
681▕ // If an exception occurs when attempting to run a query, we'll format the error
682▕ // message to include the bindings with SQL, which will make this exception a
683▕ // lot more helpful to the developer instead of just the database's errors.
684▕ catch (Exception $e) {
➜ 685▕ throw new QueryException(
686▕ $query, $this->prepareBindings($bindings), $e
687▕ );
688▕ }
689▕
+33 vendor frames
34 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
Searching here on Stackoverflow, I tried to install the library with apt-get install php-mysql
, apt-get install php7.4-mysql
, etc...
this is the result from php -m
[PHP Modules]
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
imagick
imap
intl
json
libxml
mbstring
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
I've also tried uncomment extension=pdo_mysql
on /etc/php/7.4/apache2/php.ini as well as in /etc/php/7.4/cli/php.ini and then restarting apache2, but still got the same error.
the default driver on laravel config/database.php is 'default' => env('DB_CONNECTION', 'mysql'),
and on .env I have DB_CONNECTION=mysql
Also have tried php artisan config:cache
and php artisan config:clear
Any help?