My env file
DB_CONNECTION=sqlsrv
DB_HOST=DESKTOP-ATB1EFG
DB_DATABASE=frontdesk
DB_USERNAME=sa
DB_PASSWORD=something_secret123
DB_PORT=1433
I have tested with raw php as below, it is successfully connected and return "connected" string.
serverName = "DESKTOP-ATB1EFG";
$connectionOptions = array(
"Database" => "frontdesk",
"Uid" => "sa",
"PWD" => "something_secret123"
);
//Establishes the connection
$conn = sqlsrv_connect($serverName, $connectionOptions);
if($conn){
echo "Connected!";
}else{
echo "Failed";
}
BUT, when I tried to migrate using php artisan migrate, it return QueryExeption
could not find driver (SQL: select * from sysobjects where type = 'U' and name = migrations)
Exception trace:
1 PDOException::("could not find driver")
C:\wamp64\www\frontdesk.sys\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
2
PDO::__construct("dblib:host=DESKTOP-ATB1EFG:1433;dbname=frontdesk;charset=utf8", "sa", "something_secret123", []) C:\wamp64\www\frontdesk.sys\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70
I have checked with php 7.2.10, it already enables extensions
extension=php_sqlsrv_72_nts_x64.dll
extension=php_pdo_sqlsrv_72_nts_x64.dll
extension=php_sqlsrv_72_ts_x64.dll
extension=php_pdo_sqlsrv_72_ts_x64.dll
ts
(thread-safe) andnts
(non thread-safe) versions of the sqlsrv extensions at the same time. Also, did you make sure that the extensions are enabled in both the php.ini for the CLI as well as the webserver (php-fpm or whatever)? – Namoshek