问题描述
我正在尝试安装Laravel.我已经安装了Xampp
,但是当我尝试使用php artisan migrate
设置数据库时,出现错误:
I am trying to install Laravel. I have installed Xampp
, but when I try to setup my database using php artisan migrate
I get the error:
config/database.php
文件具有相关的连接:
config/database.php
file has the relevant connections:
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'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' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
],
],
有什么想法吗?
推荐答案
在您的php.ini配置文件中,只需取消注释扩展名即可:
In your php.ini configuration file simply uncomment the extension:
;extension=php_pdo_mysql.dll
(您可以在安装堆栈服务器的php文件夹中找到 php.ini 文件.)
(You can find your php.ini file in the php folder where your stack server is installed.)
如果您使用的是 Windows ,请执行以下操作:extension=php_pdo_mysql.dll
If you're on Windows make it: extension=php_pdo_mysql.dll
如果您使用的是 Linux ,请执行以下操作:extension=pdo_mysql.so
If you're on Linux make it: extension=pdo_mysql.so
并快速重启服务器.
如果这不适用于您,则可能需要将 pdo_mysql 扩展安装到您的php库中.
If this isn't working for you, you may need to install pdo_mysql extension into your php library.
这篇关于Artisan Migration无法找到驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!