Answer the question
In order to leave comments, you need to log in
What am I not adding to the .env file when connecting sqlsrv?
Hello, I want to connect a database using sqlsrv, I understand that this is written in the .env file, but I get the following error:
Here is the database.php file:
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
],
DB_CONNECTION=sqlsrv
DB_HOST=127.0.0.1
DB_PORT=1433
DB_DATABASE=forge
DB_USERNAME=forge
DB_PASSWORD=
Answer the question
In order to leave comments, you need to log in
You need to install sqlsrv on the system:
pecl install sqlsrv \
&& echo "extension=sqlsrv.so" >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/30-sqlsrv.ini
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question