迁移命令错误:Illuminate \ Database \ QueryException:在SQL Server上找不到驱动程序

时间:2019-07-10 07:57:50

标签: laravel sql-server-2012 xampp

我刚刚安装了xampp version 3.2.4Sql Server 2012windows server 2012 R2php version 7.3.6,并使用laravel as framework,我收到了

  

Illuminate \ Database \ QueryException:找不到驱动程序(SQL:   选择*从sysobjects中,其中类型='U',名称=迁移)

我签入了phpinfo() - detected pdo_sqlsrv, 如果我try make connection to sql server没问题,"Connection established".

<?php
$serverName = "VPS712345"; //serverName\instanceName, portNumber (default is 1433)
$connectionInfo = array( "Database"=>"newautocheck", "UID"=>"laravelxxxxx", "PWD"=>"xxxxxxxxxx");
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn ) {
     echo "Connection established.<br />";
}else{
     echo "Connection could not be established.<br />";
     die( print_r( sqlsrv_errors(), true));
}
?>

但是,如果我尝试迁移到数据库,则我的项目仍然命令错误

Illuminate\Database\QueryException  : could not find driver (SQL: select * fr
om sysobjects where type = 'U' and name = migrations)

  at C:\xampp\htdocs\testdulu\vendor\laravel\framework\src\Illuminate\Database\C
onnection.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 th
is exception a
    662|         // lot more helpful to the developer instead of just the databa
se's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668|

  Exception trace:

  1   Doctrine\DBAL\Driver\PDOException::("could not find driver")
      C:\xampp\htdocs\testdulu\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDO
Connection.php:31

  2   PDOException::("could not find driver")
      C:\xampp\htdocs\testdulu\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDO
Connection.php:27

  Please use the argument -v to see more details.

可以帮助我如何迁移该项目

0 个答案:

没有答案