Connection to MS SQLServer
I configure php.ini to connect to sqlserver, added needed extension :
extension=php_sqlsrv_74_nts_x64.dll
extension=php_pdo_sqlsrv_74_nts_x64.dll
and extension loaded it is OK , MS Sql server installed and TCP port is open,
.env file and database.php file configed like these:
'sqlsrv' => [ 'driver' => 'sqlsrv', 'host' => env('DB_HOST', 'localhost'), 'port' => env('DB_PORT', '1433'), 'database' => env('DB_DATABASE', 'xxx'), 'username' => env('DB_USERNAME', 'xxx'), 'password' => env('DB_PASSWORD', 'xxx'), 'charset' => 'utf8', 'prefix' => '', 'prefix_indexes' => true, ],
DB_CONNECTION=sqlsrv DB_HOST=localhost DB_PORT=1433 DB_DATABASE=xxx DB_USERNAME=xxx DB_PASSWORD=xxx
but this is error encountered when I want to select something : "driver not found"
or if I run "php artisan migrate" I have this ERROR :
Illuminate\Database\QueryException
could not find driver (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE')
at C:\inetpub\test1\vendor\laravel\framework\src\Illuminate\Database\Connection.php:671 667| // If an exception occurs when attempting to run a query, we'll format the error 668| // message to include the bindings with SQL, which will make this exception a 669| // lot more helpful to the developer instead of just the database's errors. 670| catch (Exception $e) { 671| throw new QueryException( 672| $query, $this->prepareBindings($bindings), $e 673| ); 674| } 675|
C:\inetpub\test1\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70 PDOException::("could not find driver")
C:\inetpub\test1\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70 PDO::__construct()
thank in advance for any help.
Here is a recent article from Microsoft about SQL Server drivers https://docs.microsoft.com/en-us/sql/connect/php/system-requirements-for-the-php-sql-driver
And see https://stackoverflow.com/questions/35470841/how-to-connect-laravel-and-microsoft-sql-server
And https://laracasts.com/discuss/channels/code-review/sqlsrv-driver-not-found
Please or to participate in this conversation.