Не удалось найти драйвер Yii2 для миграции - PullRequest
0 голосов
/ 23 мая 2018

Я новичок в Yii2, поэтому у меня проблема с миграцией на сервер XAMPP.Моя версия PHP 7.1.11.Я использую расширенный шаблон Yii2, и вот так мой common/config/main-local.php файл выглядит как

<?php
return [
    'components' => [
        'db' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'mysql:host=127.0.0.1;dbname=hopordrop',
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
        ],
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'viewPath' => '@common/mail',
            // send all mails to a file by default. You have to set
            // 'useFileTransport' to false and configure a transport
            // for the mailer to send real emails.
            'useFileTransport' => true,
        ],
    ],
];

Ошибка:

 Stack trace:
    #0 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\db\Connection.php(864): yii\db\Connection->open()
    #1 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\db\Connection.php(851): yii\db\Connection->getMasterPdo()
    #2 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\db\Command.php(219): yii\db\Connection->getSlavePdo()
    #3 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\db\Command.php(894): yii\db\Command->prepare(true)
    #4 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\db\Command.php(362): yii\db\Command->queryInternal('fetchAll', NULL)
    #5 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\db\mysql\Schema.php(198): yii\db\Command->queryAll()
    #6 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\db\mysql\Schema.php(97): yii\db\mysql\Schema->findColumns(Object(yii\db\TableSchema))
    #7 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\db\Schema.php(149): yii\db\mysql\Schema->loadTableSchema('migration')#8 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\console\controllers\MigrateController.php(178): yii\db\Schema->getTableSchema('{{%migration}}', true)
    #9 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\console\controllers\BaseMigrateController.php(627): yii\console\controllers\MigrateController->getMigrationHistory(NULL)
    #10 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\console\controllers\BaseMigrateController.php(102): yii\console\controllers\BaseMigrateController->getNewMigrations()
    #11 [internal function]: yii\console\controllers\BaseMigrateController->actionUp(0)
    #12 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\base\InlineAction.php(55): call_user_func_array(Array, Array)
    #13 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\base\Controller.php(154): yii\base\InlineAction->runWithParams(Array)
    #14 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\console\Controller.php(119): yii\base\Controller->runAction('', Array)
    #15 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\base\Module.php(454): yii\console\Controller->runAction('', Array)
    #16 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\console\Application.php(180): yii\base\Module->runAction('migrate', Array)
    #17 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\console\Application.php(147): yii\console\Application->runAction('migrate', Array)
    #18 C:\xampp\htdocs\hoppordropp\vendor\yiisoft\yii2\base\Application.php(375): yii\console\Application->handleRequest(Object(yii\console\Request))
    #19 C:\xampp\htdocs\hoppordropp\yii(27): yii\base\Application->run()
    #20 {main}

При запуске php -m команда:

[PHP Modules]
bcmath
calendar
Core
ctype
date
dom
filter
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
Phar
readline
Reflection
session
SimpleXML
SPL
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]

Есть идеи, как это исправить?Я попробовал все подобные решения из ранее заданных вопросов.

Name    Result  Required By Memo
PHP version Passed  Yii Framework   PHP 5.4.0 or higher is required.
Reflection extension    Passed  Yii Framework   
PCRE extension  Passed  Yii Framework   
SPL extension   Passed  Yii Framework   
Ctype extension Passed  Yii Framework   
MBString extension  Passed  Multibyte string processing Required for multibyte encoding string processing.
OpenSSL extension   Passed  Security Component  Required by encrypt and decrypt methods.
Intl extension  Passed  Internationalization support    PHP Intl extension 1.0.2 or higher is required when you want to use advanced parameters formatting in Yii::t(), non-latin languages with Inflector::slug(), IDN-feature of EmailValidator or UrlValidator or the yii\i18n\Formatter class.
ICU version Passed  Internationalization support    ICU 49.0 or higher is required when you want to use # placeholder in plural rules (for example, plural in Formatter::asRelativeTime()) in the yii\i18n\Formatter class. Your current ICU version is 57.1.
ICU Data version    Passed  Internationalization support    ICU Data 49.1 or higher is required when you want to use # placeholder in plural rules (for example, plural in Formatter::asRelativeTime()) in the yii\i18n\Formatter class. Your current ICU Data version is 57.1.
Fileinfo extension  Passed  File Information    Required for files upload to detect correct file mime-types.
DOM extension   Passed  Document Object Model   Required for REST API to send XML responses via yii\web\XmlResponseFormatter.
PDO extension   Passed  All DB-related classes  
PDO SQLite extension    Passed  All DB-related classes  Required for SQLite database.
PDO MySQL extension Passed  All DB-related classes  Required for MySQL database.
PDO PostgreSQL extension    Passed  All DB-related classes  Required for PostgreSQL database.
Memcache extension  Warning MemCache    
APC extension   Warning ApcCache    
GD PHP extension with FreeType support  Passed  Captcha Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required for image CAPTCHA.
ImageMagick PHP extension with PNG support  Warning Captcha Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required for image CAPTCHA.
Expose PHP  Warning Security reasons    "expose_php" should be disabled at php.ini
PHP allow url include   Passed  Security reasons    "allow_url_include" should be disabled at php.ini
PHP mail SMTP   Passed  Email sending   PHP mail SMTP server required

1 Ответ

0 голосов
/ 23 мая 2018

Как вы можете прочитать в официальном руководстве , вам необходимо установить pdo , а в вашем случае pdo_mysql .Ты скучаешь по последнему.

...