Reputation: 1709
I try to use migrate databse (MS SQL) in laravel 5.4 but I got error:
$ php artisan migrate
In Connection.php line 647:
could not find driver (SQL: select * from sysobjects where type = 'U' and name = migrations)
P.S: But for query I can use it's as normal . I have problem only when migration.
Upvotes: 0
Views: 6710
Reputation: 368
Microsoft PHP Driver for SQL Server
There are drivers for Linux As well.
Extract the downloaded file anywhere. We just need the *.dll's.
FOR WINDOWS10 x 64
Copy dll's to your PHP\ext Directory.
Ensure php_pdo_sqlsrv_72_ts_x64.dll & extension=php_sqlsrv_72_ts_x64.dll are copied.
Add the following extensions
extension=php_pdo_sqlsrv_72_ts_x64.dll, extension=php_sqlsrv_72_ts_x64.dll
in your PHP.INI file (For windows 10 only, use related dll's on other windows & linux systems)
./httpd -k restart
-install them.
PROTOCOLS FOR SQLSERVER
TCP/IP
Enabled = Yes
IPAll TCP PORT = 1433
Right Click Database Engine (IP Address/MSSQLSERVER) Restart
DB_CONNECTION=sqlsrv
DB_HOST=localhost OR PCNAME\MSSQLSERVERNAME
DB_PORT=1433
DB_DATABASE=yourdatabase
DB_USERNAME=yourusername
DB_PASSWORD=yourpassword
CHECK THE CONNECTION
if(DB::connection()->getDatabaseName())
{
echo "<h3>connected successfully to database ".DB::connection()->getDatabaseName() . "</h3>";
}
Upvotes: 2