尝试 php artisan 迁移时找不到驱动程序

问题描述 投票:0回答:1

你好,我在我的代码中发现了一个问题,如下所示:

Illuminate\Database\QueryException 

  could not find driver (Connection: mysql, SQL: select table_name as `name`, (data_length + index_length) as `size`, table_comment as `comment`, engine as `engine`, table_collation as `collation` from information_schema.tables where table_schema = 'sistem-inventory' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)

  at vendor\laravel\framework\src\Illuminate\Database\Connection.php:829
    825▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    826▕                 );
    827▕             }
  ➜ 829▕             throw new QueryException(
    830▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    831▕             );
    832▕         }
    833▕     }

  1   vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:65
      PDOExcepti

我已经尝试在我的 php.ini 中取消注释这两行

extension=pdo.so 
extension=pdo_mysql.so

但错误仍然相同,任何帮助将不胜感激。谢谢你

php mysql migration database-migration
1个回答
0
投票

Windows 上的 PHP 使用 DLL 文件而不是 so 文件。要启用此驱动程序,您需要在 php.ini 文件中使用以下扩展行:

extension=php_pdo.dll
extension=php_pdo_mysql.dll

这些DLL应该存在于系统的extension_dir中。它们应该包含在您拥有的 Windows 版本的 PHP 中,但如果没有,您可以从相应的 PHP zip 发行版中获取它们,网址为 https://windows.php.net/download/

© www.soinside.com 2019 - 2024. All rights reserved.