Can someone help me out with this problem I have tried all possible solution to no avail
Unable to do php artisan migrate
Illuminate\Database\QueryException : could not find driver (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrations and table_type = 'BASE TABLE')
at /opt/lampp/htdocs/meriki/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664 660| // If an exception occurs when attempting to run a query, we'll format the error 661| // message to include the bindings with SQL, which will make this exception a 662| // lot more helpful to the developer instead of just the database's errors. 663| catch (Exception $e) {
664| throw new QueryException( 665| $query, $this->prepareBindings($bindings), $e 666| ); 667| } 668|
Exception trace:
1 PDOException::("could not find driver") /opt/lampp/htdocs/meriki/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=homestead", "homestead", "secret", []) /opt/lampp/htdocs/meriki/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
Sid you set up your .env file? Is MySQL installed?
@kel_ I have Mysql Install and here with below is my .ENV file
APP_NAME=Laravel APP_ENV=local APP_KEY=base64:0aafhzDH8z9R5EVltUMIspXZ3P856PXzBbyPoGRcJ2o= APP_DEBUG=true APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=MySql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=meriki DB_USERNAME=root DB_PASSWORD=
BROADCAST_DRIVER=log CACHE_DRIVER=file QUEUE_CONNECTION=sync SESSION_DRIVER=file SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379
MAIL_DRIVER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null
AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET=
PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
Okay!
Check your php.ini file, look for this line:
;extension=pdo_mysql.so
and uncomment it, then restart your web server.
@kel_ I have done that and also restart my server the problem is still the same as seen below
Illuminate\Database\QueryException : could not find driver (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrations and table_type = 'BASE TABLE')
at /opt/lampp/htdocs/meriki/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664 660| // If an exception occurs when attempting to run a query, we'll format the error 661| // message to include the bindings with SQL, which will make this exception a 662| // lot more helpful to the developer instead of just the database's errors. 663| catch (Exception $e) {
664| throw new QueryException( 665| $query, $this->prepareBindings($bindings), $e 666| ); 667| } 668|
Exception trace:
1 PDOException::("could not find driver") /opt/lampp/htdocs/meriki/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=homestead", "homestead", "secret", []) /opt/lampp/htdocs/meriki/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
Please use the argument -v to see more details.
Okay, which OS are you using?
Oh, and did you configure the 'default' key in app/config/database.php?
@kel_ Okay, which OS are you using? I am using Linux Deeping Manjaro (Arch Linux)
Oh, and did you configure the 'default' key in app/config/database.php? I am not sure here is the source of the app/config/database.php?
@kel_ kindly advise on how I can configure the 'default' key in app/config/database.php?
Thanks
'default' => env('DB_CONNECTION', 'mysql'),
@kel_ I just added it and this is how it looks as seen below but I still get the same error
'mysql' => [ 'default' => env('DB_CONNECTION', 'mysql'), 'driver' => 'mysql', 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => 'utf8', 'collation' =>'utf8_general_ci', 'prefix' => '', 'prefix_indexes' => true, 'strict' => true, 'engine' => null, 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], ],
clearly, Laravel thinks your database is homestead
have you php artisan config:clear ?
open tinker and type
>>> config('database')
tell us what it replies
are you actually running homestead?
@snapey This is the response from Tinker
=> [ "default" => "mysql", "connections" => [ "sqlite" => [ "driver" => "sqlite", "url" => null, "database" => "meriki", "prefix" => "", "foreign_key_constraints" => true, ], "mysql" => [ "driver" => "mysql", "default" => "mysql", "url" => null, "host" => "127.0.0.1", "port" => "3306", "database" => "meriki", "username" => "root", "password" => "fifa@2020", "unix_socket" => "", "charset" => "utf8", "collation" => "utf8_general_ci", "prefix" => "", "prefix_indexes" => true, "strict" => true, "engine" => null, "options" => [], ], "pgsql" => [ "driver" => "pgsql", "url" => null, "host" => "127.0.0.1", "port" => "3306", "database" => "meriki", "username" => "root", "password" => "fifa@2020", "charset" => "utf8", "prefix" => "", "prefix_indexes" => true, "schema" => "public", "sslmode" => "prefer", ], "sqlsrv" => [ "driver" => "sqlsrv", "url" => null, "host" => "127.0.0.1", "port" => "3306", "database" => "meriki", "username" => "root", "password" => "fifa@2020", "charset" => "utf8", "prefix" => "", "prefix_indexes" => true, ], ], "migrations" => "migrations", "redis" => [ "client" => "predis", "options" => [ "cluster" => "predis", "prefix" => "laravel_database_", ], "default" => [ "host" => "127.0.0.1", "password" => null, "port" => "6379", "database" => 0, ], "cache" => [ "host" => "127.0.0.1", "password" => null, "port" => "6379", "database" => 1, ], ], ]
Please advise what next
Please set the DB_CONNECTION value in your env file to lower case, as there is no 'MySql' key in your connections array
@kima I have done that but I still the same error
Illuminate\Database\QueryException : could not find driver (SQL: select * from information_schema.tables where table_schema = meriki and table_name = migrations and table_type = 'BASE TABLE')
at /opt/lampp/htdocs/meriki/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664 660| // If an exception occurs when attempting to run a query, we'll format the error 661| // message to include the bindings with SQL, which will make this exception a 662| // lot more helpful to the developer instead of just the database's errors. 663| catch (Exception $e) {
664| throw new QueryException( 665| $query, $this->prepareBindings($bindings), $e 666| ); 667| } 668|
Exception trace:
1 PDOException::("could not find driver") /opt/lampp/htdocs/meriki/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=meriki", "root", "fifa@2020", []) /opt/lampp/htdocs/meriki/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
Please use the argument -v to see more details.
Have you checked to make sure you have the PDO PHP Extension installed on your server? Also, do you happen to have 2 different versions of PHP installed? Sometimes if you have 2 installations and they aren't linked properly to the correct configuration it will cause issues.
Are you using a debugger?
I noticed some issues in StackOF, all of them pointing to the mysqlnd extension. Please check your php-mysqlnd extension is updated to your php version, and loaded properly by Apache. Restart Apache if needed.
@kima please advise on how I can solve this with your proposed solution or what command can I run
When you do php --ini in your console, does all of your PHP configuration point to one place?
Is MySQL actually running (check with systemctl status mysql.service) and have you created a database named meriki? If you are not using Homestead, did you create the migrations table by doing php artisan migrate:install?
@loudriot This is the result from my console if I type php --ini
[elmeriki-pc meriki]# php --ini
Configuration File (php.ini) Path: /etc/php
Loaded Configuration File: /etc/php/php.ini
Scan for additional .ini files in: /etc/php/conf.d
Additional .ini files parsed: (none)
I'm not familiar with the mysqlnd extension, but I check the php.net (https://www.php.net/manual/en/mysqlnd.install.php) page and noticed this:
The MySQL database extensions must be configured to use the MySQL Client Library. In order to use the MySQL Native Driver, PHP needs to be built specifying that the MySQL database extensions are compiled with MySQL Native Driver support. This is done through configuration options prior to building the PHP source code.
As I can see, you have no other DB extention, mysqli for example
@meriki Yeah, so the issue looks like your PHP is not loading in your extensions.
This line: Additional .ini files parsed: (none) - Should be showing your extensions that it's loading, unless it's different for that OS.
what do you advise I do reinstall?
Yeah I would reinstall PHP
Thanks to everyone for your support I finally sorted the issues, i have to uninstall xampp which I was using and install Apache,MariaDB, and PHP manually and I have to reinstall laravel all over and it now works for me perfectly well
Please or to participate in this conversation.